黑暗之魂3在哪洗点:vb连接sql数据库~~~~在线等,急~~~~~~

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/05 09:24:18
Private Sub cmdOK_Click()
Dim txtSQL As String
Dim MsgText As String
Dim mrc As ADODB.Recordset
Dim UserName
txtSQL = "select ID from ID_TB where ID='" & Trim(txtUserName.Text) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox " 用户名错误!", vbExclamation + vbOKOnly, "警告"
txtUserName.SetFocus
txtUserName.SelStart = 0
txtUserName.SelLength = Len(txtUserName.Text)
Exit Sub
End If
UserName = mrc.Fields(0)
txtSQL = "select PWD from ID_MIS where PWD='" & Trim(txtPassword.Text) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox " 密码错误!", vbExclamation + vbOKOnly, "警告"
txtPassword.SetFocus
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
Exit Sub
End If

frmMain.Show
Unload Me
End Sub

编译通过,
提示“未发现数据源名称”

请问;以上代码时访问何种数据库类型?要用到那种数据源?

你要把你的connectionstring帖出来,可能是你的ConnectionString里有拼写错误,或者你没有正确配置你的SQL SERVER引起的

可能是ExecuteSQL函数有问题,你把这个发上来看看