求助!!参数不足,期待是1
PrivateSubCommand1_Click()'1、声明变量DimdbAsNewADODB.ConnectionDimRsUserAsNewADODB.Record...
Private Sub Command1_Click()
'1、声明变量
Dim db As New ADODB.Connection
Dim RsUser As New ADODB.Recordset
Dim strSql As String
Dim connStr As String
'2、打开数据库连接
connStr = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & App.Path & "\custom.mdb" '连接Access的连接字符串
db.CursorLocation = adUseClient
db.Open connStr
'3、执行sql语句,把查询结果存在recordSet变量中
strSql = "delete from 用户信息 where 用户名=" & Text1.Text & ""
db.Execute strSql'(这里提示是参数不足,期待是1是什么原因啊)
'4、将结果根据实际需要显示在控件中
strSql = "select * from 用户信息"
RsUser.Open strSql, db, adOpenDynamic, adLockReadOnly
Set DataGrid1.DataSource = RsUser
DataGrid1.Refresh
End Sub 展开
'1、声明变量
Dim db As New ADODB.Connection
Dim RsUser As New ADODB.Recordset
Dim strSql As String
Dim connStr As String
'2、打开数据库连接
connStr = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & App.Path & "\custom.mdb" '连接Access的连接字符串
db.CursorLocation = adUseClient
db.Open connStr
'3、执行sql语句,把查询结果存在recordSet变量中
strSql = "delete from 用户信息 where 用户名=" & Text1.Text & ""
db.Execute strSql'(这里提示是参数不足,期待是1是什么原因啊)
'4、将结果根据实际需要显示在控件中
strSql = "select * from 用户信息"
RsUser.Open strSql, db, adOpenDynamic, adLockReadOnly
Set DataGrid1.DataSource = RsUser
DataGrid1.Refresh
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询