首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

实时异常 '-2147467259(80004005)'[connectionopen(connect()).]SQL server 不存在或拒绝访问

2012-01-13 
实时错误 -2147467259(80004005)[connectionopen(connect()).]SQL server 不存在或拒绝访问PrivateSubcm

实时错误 '-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 "

热点排行