实时错误 '-2147467259(80004005)'[connectionopen(connect()).]SQL server 不存在或拒绝访问
Private Sub cmdok_Click(Index As Integer)
If txtUserName.Text = " " Then
MsgBox "你的输入姓名为空,请重新输入。 "
txtUserName.SetFocus
ElseIf txtPassword.Text = " " Then
MsgBox "你的输入密码为空,请重新输入。 "
txtPassword.SetFocus
Else
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strconn
Dim sql
strconn = "provider=SQLOLEDB.1;server=local;persist security info=false;UID=sa;pwd=415024522;database=F:\ypjxcmis\Data\Drug_Data.MDF "
conn.Open strconn
sql = "select * from user_info where username= ' " & txtUserName.Text & " 'and userpassword= ' " & txtPassword.Text & " ' "
rs.Open sql, conn, adOpenKeyset, adLockOptimistic
If Not rs.EOF Then
Me.Hide
frm_client_info.Show
Else
MsgBox "你的输入有错误,请重新输入。 "
txtUserName.Text = " "
txtPassword.Text = " "
txtUserName.SetFocus
End If
End If
End Sub
我的代码是上边的,请大家帮忙看看是那儿的错误?在这小弟先谢谢各位了!
[解决办法]
strconn = "provider=SQLOLEDB.1;server=local;persist security info=false;UID=sa;pwd=415024522;database=F:\ypjxcmis\Data\Drug_Data.MDF "
错了
改为这样试试
strconn = "provider=SQLOLEDB.1;server=local;persist security info=false;UID=sa;pwd=415024522;database=Drug "