VB修改SQL数据问题

来源:百度知道 编辑:UC知道 时间:2024/06/07 15:54:34
Private Sub Command4_Click()
Dim rs As New ADODB.Recordset
Dim conn As New ADODB.Connection
Dim sql As String

sql = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;password=sa;Initial Catalog=qmsj;Data Source=(local)"
conn.ConnectionString = sql

If Len(Text2.Text) <> 0 Then
sql = "select * from 商品 where 商品号='" & Text2.Text & "'"

If rs.RecordCount = 1 Then
rs.Fields("商品名") = Text3.Text
rs.Fields("商品类型号") = Text4.Text
rs.Fields("供应商号 ") = Text5.Text
rs.Update
End If
End If

End Sub

rs.Open sql, conn这行错误 谁能解决下

rs.Open sql, conn, 3, 2

rs.Open sql, conn 在拿一行?是不是在 sql = "select * from 商品 where 商品号='" & Text2.Text & "'"
语句的下方,你打开数据源的时候应该使的它有可写属性,rs.Open sql, conn, 3, 2