VC6.0 使用ADO数据库在报表中实现检索功能,如何能修改检索后的信息,并能更新到数据库中?

VC6.0 使用ADO数据库在报表中实现检索功能,如何能修改检索后的信息,并能更新到数据库中?,第1张

select * from table where ````rs->open(.....)if(rs->adoEOF){ MessageBox("没有这个数据") rs->close() }rs->PutCollect(....)rs->Update()rs->Close

/// <summary>

/// 说明:updata主要用于新增,修改,删除!

/// 参数:sqlstr是SQL语句!

/// </summary>

public Boolean updata(string sqlstr)

{

SqlConnection con = new SqlConnection()

SqlCommand com = new SqlCommand()

con.ConnectionString ="server=.\SQLEXPRESSdatabase=sp_serverdbintegrated security=SSPI"

com.CommandText = sqlstr

com.Connection = con

try

{

con.Open()

com.ExecuteNonQuery()

con.Close()

return true

}

catch (Exception)

{

con.Close()

return false

}

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/9442386.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-28
下一篇 2023-04-28

发表评论

登录后才能评论

评论列表(0条)

保存