这帖子还有人帮助么?VB更新数据库的问题。
模块里:Module Module2
Public con As New SqlClient.SqlConnection("Data Source=XP-8925;initial Catalog=小型数据库;User ID=sa;password=1234")
End Module
窗体代码:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim sql As String
Dim dt As New DataTable()
sql = "select * from 库存" '打开数据库
Dim rs As New SqlDataAdapter(sql, con)
rs.Fill(dt)
DataGridView1.DataSource = dt
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
此代码想要更新SQL数据库该怎么写?谢谢。
End Sub
以上代码运行正常《我的问题是;怎么把修改过的数据更新到SQL数据库.》
菜鸟求帮助!!!