各位好:
我現在正學習一個寫一個小程序 ,一個系統進入窗體,用來輸入用戶名和密碼的,用ADODC控件來邊接SQL數據庫,從而判斷用戶是否存在,請教各位詳細的介紹好嗎!!
謝謝!!!!
我現在正學習一個寫一個小程序 ,一個系統進入窗體,用來輸入用戶名和密碼的,用ADODC控件來邊接SQL數據庫,從而判斷用戶是否存在,請教各位詳細的介紹好嗎!!
謝謝!!!!
解决方案 »
- 非常感谢!已结贴。
- 在VB中调用C#编写的Com 组件可以吗?
- VB + SQL SERVER 2000下开发的程序能利用MSDE一起打包吗,从而脱离SQL SERVER 2000安装到其它机器上吗
- 各位大哥,100份求救!处理一excel数据文件,怎样将这个excel中的某一行在满.....
- 请问如何用VB设置本机的桌面背景为\\server\admin\1.bmp?
- 为什么我的vb6不能用index
- 如果用ADO建有密码的数据库?
- 如何判断一个表是否已经打开?
- 请问报表高手,做报表用哪种控件比较好
- 打开vb6时,出现缺少mini.msi错误,怎么办,谢谢
- 关于注册控件的问题
- 导出excel数据出错
strCon = "Driver={sql server};server=" & Trim(txtServer.Text) & ";uid=" & Trim(txtUser.Text) & ";pwd=" & Trim(txtPws.Text) & ";database=" & Trim(txtDatabase.Text)
cnSQL.CommandTimeout = 1000
cnSQL.CursorLocation = adUseServer
cnSQL.Open strCon
If cnSQL.State = 1 And Err.Number = 0 Then bConnect = True
MsgBox "Connection success!", vbOKOnly + vbInformation
Else
' Else
Set cnSQL = Nothing
bConnect = False
MsgBox "Connection failed!", vbOKOnly + vbInformation
End If
txtsql = "select username,password from use where username='" & _
Trim(Text1.Text) & "'"
Set mrc = ExecuteSQL(txtsql) '查询用户
If mrc.EOF = True Then
MsgBox " 用户名错误!", vbExclamation + vbOKOnly, "警告"
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Exit Sub
End If
username = mrc.Fields(0)
If Trim(Text2.Text) <> mrc.Fields(1) Then
MsgBox " 密码错误!", vbExclamation + vbOKOnly, "警告"
Text2.SetFocus
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
Exit Sub
End If
'显示主窗体
MDIForm1.Show
'卸载登录窗体
Unload Me不要管人家用什么!回答了,给分就行!
Adodc1.RecordSource = "Select * From mLogin Where UserName = '" & Text1.Text & "' And PassWord = '" & Text2.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
MsgBox "用户名或密码错,请重输!"
Text1.SetFocus
Else
MDIForm1.Show
Unload Me
End If
End SubPrivate Sub Form_Load()
Adodc1.Visible = False
Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=;Initial Catalog=Test;Data Source=Server"
Adodc1.ConnectionTimeout = 0
Adodc1.CommandType = adCmdText
Adodc1.CursorLocation = adUseClient
Adodc1.CursorType = adOpenStatic
Adodc1.LockType = adLockOptimistic
End Sub