qadeer37
Well-known member
Imports db = System.Data
Public Class CustomerADO
Dim cid As Integer
Dim fn, ln, em, pw As String
Dim bl As Decimal
Private ssConnection As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\QADEER\Documents\MyShop.accdb"
Public Sub GetCustomers()
Dim dbConn As db.OleDb.OleDbConnection
dbConn = New db.OleDb.OleDbConnection(ssConnection)
dbConn.Open()
Dim sql As String = "Select * from Customer;"
Dim dbCmd As db.OleDb.OleDbCommand
dbCmd = New db.OleDb.OleDbCommand(sql, dbConn)
Dim DataReader As db.OleDb.OleDbDataReader
DataReader = dbCmd.ExecuteReader
Do While DataReader.Read
cid = System.Convert.ToInt32(DataReader("CID"))
fn = System.Convert.ToString(DataReader("FirstName"))
ln = System.Convert.ToString(DataReader("LastName"))
em = System.Convert.ToString(DataReader("EmailAddress"))
bl = System.Convert.ToDecimal(DataReader("Balance"))
pw = System.Convert.ToString(DataReader("Password"))
Dim objCustomer As Customer
objCustomer = New Customer(cid, fn, ln, em, bl, pw)
Loop
End Sub
End Class
what should I do in the while loop to make array of customers objects.
&
what should be the code in the form to add this array of customers to listbox.
If this information is not enough plz ask for additional information.Thanks.
Public Class CustomerADO
Dim cid As Integer
Dim fn, ln, em, pw As String
Dim bl As Decimal
Private ssConnection As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\QADEER\Documents\MyShop.accdb"
Public Sub GetCustomers()
Dim dbConn As db.OleDb.OleDbConnection
dbConn = New db.OleDb.OleDbConnection(ssConnection)
dbConn.Open()
Dim sql As String = "Select * from Customer;"
Dim dbCmd As db.OleDb.OleDbCommand
dbCmd = New db.OleDb.OleDbCommand(sql, dbConn)
Dim DataReader As db.OleDb.OleDbDataReader
DataReader = dbCmd.ExecuteReader
Do While DataReader.Read
cid = System.Convert.ToInt32(DataReader("CID"))
fn = System.Convert.ToString(DataReader("FirstName"))
ln = System.Convert.ToString(DataReader("LastName"))
em = System.Convert.ToString(DataReader("EmailAddress"))
bl = System.Convert.ToDecimal(DataReader("Balance"))
pw = System.Convert.ToString(DataReader("Password"))
Dim objCustomer As Customer
objCustomer = New Customer(cid, fn, ln, em, bl, pw)
Loop
End Sub
End Class
what should I do in the while loop to make array of customers objects.
&
what should be the code in the form to add this array of customers to listbox.
If this information is not enough plz ask for additional information.Thanks.