大码安全裤:VB急救!数据修改!谢谢各位!

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/11 17:16:45
Private Sub Command1_Click()
Dim SQL As String
Dim i As Integer
For i = 1 To 5
If Text1(i) = "" Then
MsgBox "对不起:" & Label1(i).Caption & "不能为空!", vbInformation + vbOKOnly, "警告"
Text1(i).SetFocus
Exit Sub
End If
Next

SQL = "update 总表 set 光盘序号=""" & Text1(0).Text & """,光盘名称=""" & Text1(1).Text & """,ISBN=" & Text1(2).Text & ",出版社=""" & Text1(3).Text & """,数量=" & Text1(4).Text & ",存量=""" & Text1(5).Text & """"
OpenDBFile

gCon.Execute SQL

CloseDBFile
光盘库管理.Adodc1.Refresh
MsgBox "信息修改成功,请返回!", vbInformation + vbOKOnly, "提示"
Unload Me
End Sub

Private Sub Command2_Click()
Unload Me

End Sub

Private Sub Form_Load()
Dim SQL As String
Dim i As Integer

For i = 0 To 5
光盘库管理.DataGrid1.Col = i
Text1(i).Text = 光盘库管理.DataGrid1.Text
Next

Text1(0).Enabled = False

End Sub

**********************************************************
以上是窗体的内容~我一执行它就说“至少一个参数未设定”
错误指向 gCon.Execute SQL
我觉得可能是我的SQL语句有点问题,请大家帮我看看,谢谢了!!!

SQL = "update 总表 set 光盘序号='" & Text1(0).Text & "',光盘名称='" & Text1(1).Text & "',ISBN=" & Text1(2).Text & ",出版社='" & Text1(3).Text & "',数量=" & Text1(4).Text & ",存量='" & Text1(5).Text & "'"