Option Explicit
Dim sqlstr As String
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
----------------------------------------------------------------
Private Sub cmdclose_Click()
Unload Me
End Sub
--------------------------------------------------------------
Private Sub cmdok_Click()
Dim sqlstr1 As String
sqlstr1 = "select * from login_用户 where 用户名='" & txt_用户名.Text & "'"
conn.Open sqlstr1
If Not conn.EOF Then
MsgBox "用户名错误!", vbInformation
Exit Sub
End If
If txt_密码.Text = conn.密码 Then
frmmain.Show
upload
End If
Else
MsgBox "用户名或密码错误!"
Exit Sub
End If
End Sub
Private Sub Form_Load()
'连接sql server
sqlstr = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;passwore=52125212;Initial Catalog=zjx;Data Source=YSL"
End Sub
================================================================
我和sql server连上了,请高手帮小弟我看看打开数据库方法对吗?这是个用户登陆界面~!