Visual Studio 2005 中vb.net 与数据库sql server2000 的连接问题
Visual Studio 2005 中 与数据库sql server2000 的连接问题Private Sub buttonlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonlogin.Click
uid = txtusername.Text
pwd = txtpassword.Text
mydatabase = txtdb.Text
myserver = cobserver.Text
If db.ConnectionString <> "" Then
MsgBox("已有用户登录,请先注销再登陆", , "登录")
Me.Close()
Exit Sub
End If
db.Connectionstring = "workstation id="& myserver & _
"user id=" & uid & _
"password=" & pwd & _
"Data Source=" & myserver & _
"Initial Catalog=" & mydatabase
If uid = "" Then
MsgBox("请输入用户名", , "登录")
Me.Close()
Exit Sub
End If
On Error GoTo errorhandle
db.Open()
db.Close()
With frmmain1
.mnudatabase.Enabled = True
.mnutrade.Enabled = True
.mnustatistics.Enabled = True
.mnureport.Enabled = True
.mnudatabase.MenuItems(0).Enabled = True
.mnudatabase.MenuItems(1).Enabled = True
.mnudatabase.MenuItems(2).Enabled = True
.mnudatabase.MenuItems(3).Enabled = True
.mnudatabase.MenuItems(4).Enabled = True
.mnudatabase.MenuItems(5).Enabled = True
.mnudatabase.MenuItems(6).Enabled = True
.mnudatabase.MenuItems(7).Enabled = True
End With
Me.Close()
Exit Sub
errorhandle:
showerr()
db.C
uid = ""
pwd = ""
myserver = ""
mydatabase = ""
Me.Close()
End Sub
以上是我的一个程序的登陆对话框,但为什么程序就是连接不上数据库呢,急啊
求助,
是带颜色的那