could some one please let me know how to open database(Access) and check for login name and password from the user table at runtime. I want to check for all the available users in the table.
this should do it for you. as commented in the code, there are two techniques and I've only gotten one of them to work, but it should do what you want.
Following is an example of opening and reading a Access Database table.
You will need to make several modifications to get it to work with your DataBase. Review the comments and make adjustments as necesary.
Code:
Option Explicit
' Set a reference to "Microsoft ActiveX Data Object 2.5 LIbrary"
' Add a Listbox to the Form
' Add a command button to the Form
Dim AccessConnect As String
Dim Conn1 As ADODB.Connection
Dim Cmd1 As ADODB.Command
Dim Params1 As ADODB.Parameters
Dim Param1 As ADODB.Parameter
Dim Rs1 As ADODB.Recordset
Private Sub Command1_Click()
' following statement has the following requirements
' 1. DBQ = DataBase name
' 2. DefaultDir is its location
AccessConnect = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=ADODEMO.MDB;" & _
"DefaultDir=C:\VB Stuff\ADO Example (MSDN);" & _
"UID=admin;PWD=;"
Set Conn1 = New ADODB.Connection
Conn1.ConnectionString = AccessConnect
Conn1.Open
Set Cmd1 = New ADODB.Command
Cmd1.ActiveConnection = Conn1
' The following statement Selects the table
Cmd1.CommandText = "SELECT * FROM Authors "
Set Param1 = Cmd1.CreateParameter(, adInteger, adParamInput, 3)
Param1.Value = 10
Cmd1.Parameters.Append Param1
Set Param1 = Nothing
Set Rs1 = Cmd1.Execute()
While Rs1.EOF = False
' The following will access the individual records and add
' appropriate data to the listbox
List1.AddItem vbTab & Rs1.Fields(0).Value & " | " & _
Rs1(1).Value & " | " & _
Rs1("Year Born")
Rs1.MoveNext
Wend
Conn1.Close
End Sub
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.