Option Explicit Dim myDB As ADODB.Connection Dim rs As ADODB.Recordset Private Sub cmdLogIn_Click() Dim rs As ADODB.Recordset ' Set rs = New ADODB.Recordset ' rs.Open "Select UserName, Password FROM userinfo", myDB, adOpenStatic, adLockReadOnly If txtUsername.Text = "" Or txtPass.Text = "" Then MsgBox "You must fill in UserName or Password", vbCritical, "ERROR" txtUsername.SetFocus Exit Sub End If Do While Not rs.EOF ' If UCase(txtUsername.Text) = UCase(rs.Fields!UserName) And UCase(txtPass.Text) = UCase(rs.Fields!Password) Then If (UCase(txtUsername.Text) = UCase(rs.Fields!UserName)) And (UCase(txtPass.Text) = UCase(rs.Fields!Password)) Then MsgBox "You are Now LogIn" frmMain.Show frmLogIn.Visible = False frmMainFrame.Visible = False Else MsgBox "Wrong Input" frmLogIn.Show End If Exit Sub rs.MoveNext Loop End Sub 'Set myDB = New ADODB.Connection ' to connect to sqlserver ' myDB.ConnectionString = "Provider=SQLOLEDB;Server=" & "STI-46901090D95" & ";Initial Catalog=" & ";UID=" & "sa" & ";PWD=" & "sti" & "" ' myDB.Open "DSN=STIBAKE" ' master is database name 'Set rs = New ADODB.Recordset 'rs.Open "Select UserName, Password FROM userinfo", myDB, adOpenStatic, adLockReadOnly 'On Error Resume Next 'Set Connstr = New Connection 'Connstr.ConnectionString = "Provider=SQLOLEDB;Server=" & "STI-46901090D95" & ";Initial Catalog=" & "STIBAKE" & ";UID=" & "sa" & ";PWD=" & "sti" & "" 'Connstr.Open ' Dim rs As Recordset ' Set rs = New Recordset 'rs.Open "Select UserName,Password FROM userinfo", Connstr, adOpenStatic, adLockOptimistic ' Dim rs As ADODB.Recordset ' Set rs = New ADODB.Recordset ' rs.Open "Select UserName, Password FROM userinfo", Connstr, adOpenStatic, adLockReadOnly 'End Sub Private Sub Form_Load() On Error Resume Next Set myDB = New ADODB.Connection myDB.Open "PROVIDER = Microsoft.Jet.OLEDB.4.0;Data Source =" & App.Path & "\db1.mdb;" Set rs = New ADODB.Recordset rs.Open "SELECT * FROM TABLE1", myDB, adOpenStatic, adLockOptimistic End Sub
| |
|
Welcome to KnowledgeSutra - Dear Guest | |
Visual Basic 6.0 Help Needed
Started by rejected, Dec 04 2005 08:26 AM
21 replies to this topic
#21
Posted 04 February 2010 - 01:23 PM
I need a help how to connect sql2000 to vb6.0
#22
Posted 10 February 2010 - 07:51 AM
Files in vb6Visual Basic 6.0 Help Needed
Greetings!How to read multiline text file and how to display those lines into combo/list box?
Details:Say,a file "ProjectList.Txt" contains list of projects...Just I wan a read those names of project and wan a display those into combo...So that I can select any one of them for further process...
Thank you...
-reply by tejuReply to this topic

1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users














