Access VBA rs.Open sql, cn 至少有一个参数没有指定值
PrivateSubCommand5_Click()DimcnAsADODB.ConnectionDimrsAsNewADODB.RecordsetDimusername...
Private Sub Command5_Click()
Dim cn As ADODB.Connection
Dim rs As New ADODB.Recordset
Dim username As String
Dim userpass As String
Dim sql As String
Set cn = CurrentProject.Connection
Text7.SetFocus
username = Text7.Text
Text9.SetFocus
userpass = Text9.Text
sql = "select * from 用户表 where username='" & 用户名 & "'and password='" & 密码 & "'"
rs.Open sql, cn
If rs.EOF Then
MsgBox "登录失败"
Text7.SetFocus
Text7.Text = ""
Text9.SetFocus
Text9.Text = ""
Else
DoCmd.Close
DoCmd.OpenForm "主界面"
MsgBox "登录成功"
End If '关闭Recordset对象和Connection对象并释放内存资源
rs.Close
cn.Close
Set rs = Nothing
End Sub 展开
Dim cn As ADODB.Connection
Dim rs As New ADODB.Recordset
Dim username As String
Dim userpass As String
Dim sql As String
Set cn = CurrentProject.Connection
Text7.SetFocus
username = Text7.Text
Text9.SetFocus
userpass = Text9.Text
sql = "select * from 用户表 where username='" & 用户名 & "'and password='" & 密码 & "'"
rs.Open sql, cn
If rs.EOF Then
MsgBox "登录失败"
Text7.SetFocus
Text7.Text = ""
Text9.SetFocus
Text9.Text = ""
Else
DoCmd.Close
DoCmd.OpenForm "主界面"
MsgBox "登录成功"
End If '关闭Recordset对象和Connection对象并释放内存资源
rs.Close
cn.Close
Set rs = Nothing
End Sub 展开
ZESTRON
2024-09-04 广告
2024-09-04 广告
在Dr. O.K. Wack Chemie GmbH,我们高度重视ZESTRON的表界面分析技术。该技术通过深入研究材料表面与界面的性质,为提升产品质量与可靠性提供了有力支持。ZESTRON的表界面分析不仅涵盖了相变化、化学反应、吸附与解吸...
点击进入详情页
本回答由ZESTRON提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询