哎,我写了程序有时能删,有时又不能
vb中: Adodc1.Recordset.Delete
Adodc1.Refresh
vb.net中:
Dim dr As DataRow = ds.Tables("users").Rows(dgUser.CurrentRowIndex)
Dim de As SqlCommand
'定义删除语句
Dim delet As String = "DELETE users WHERE name ='" & dr("name") & "'"
'打开连接
cn.Open()
'执行删除命令
de = New SqlCommand(delet, cn)
de.ExecuteReader()
'关闭连接
cn.Close()
ds.Clear()
ds为DataSet对象,cn为SqlConnetion对象,users为表名,name为字段名
vb中: Adodc1.Recordset.Delete
Adodc1.Refresh
vb.net中:
Dim dr As DataRow = ds.Tables("users").Rows(dgUser.CurrentRowIndex)
Dim de As SqlCommand
'定义删除语句
Dim delet As String = "DELETE users WHERE name ='" & dr("name") & "'"
'打开连接
cn.Open()
'执行删除命令
de = New SqlCommand(delet, cn)
de.ExecuteReader()
'关闭连接
cn.Close()
ds.Clear()
ds为DataSet对象,cn为SqlConnetion对象,users为表名,name为字段名
VB中,不用ADODC控件,只用代码,什么删?