B
BY
Hi,
This is my code and it works fine...
Dim Conn As OleDb.OleDbConnection
Dim Cmd As OleDb.OleDbCommand
Dim Reader As OleDb.OleDbDataReader
Dim i As Integer
Conn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\SAMPLES\Northwind.mdb;Persist Security Info=False")
Cmd = New OleDb.OleDbCommand("SELECT CompanyName FROM CUSTOMERS", Conn)
Conn.Open()
Try
Reader = Cmd.ExecuteReader
i = 1
While (Reader.Read())
ListBox1.Items.Add(i & " " & Reader.GetString(0))
i = i + 1
End While
Finally
Reader.Close()
Conn.Close()
End Try
I have got 2 problems actually where I couldn't find any explanation for in
"Microsoft Visual Basic. Net Step by Step Deluxe Learning Edition"... But I
am still learning...
The first thing is, when someone clicks to a CompanyName in the ListBox(see
code above) I want to display additional information about that company on a
label...
My second problem is, I have another database with contacts... I have a
TextBox, a Button and again a label... If I write the name of a person in
the TextBox and clicks the Button the program should find that person in the
database and show all adress details on the label...
I know that both are related, but I really couldn't find anything about it
on the internet... I have read that the recordsets/records/fields are
changed into .Item, but I couldn't find any detailed information about it,
just as I couldn't find any information about GetString (see code above...?)
I am not expecting that you solve my problems, but I hope that you can point
me in the right direction...
Thanks in advance for all your help.
Regards,
BY
This is my code and it works fine...
Dim Conn As OleDb.OleDbConnection
Dim Cmd As OleDb.OleDbCommand
Dim Reader As OleDb.OleDbDataReader
Dim i As Integer
Conn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\SAMPLES\Northwind.mdb;Persist Security Info=False")
Cmd = New OleDb.OleDbCommand("SELECT CompanyName FROM CUSTOMERS", Conn)
Conn.Open()
Try
Reader = Cmd.ExecuteReader
i = 1
While (Reader.Read())
ListBox1.Items.Add(i & " " & Reader.GetString(0))
i = i + 1
End While
Finally
Reader.Close()
Conn.Close()
End Try
I have got 2 problems actually where I couldn't find any explanation for in
"Microsoft Visual Basic. Net Step by Step Deluxe Learning Edition"... But I
am still learning...
The first thing is, when someone clicks to a CompanyName in the ListBox(see
code above) I want to display additional information about that company on a
label...
My second problem is, I have another database with contacts... I have a
TextBox, a Button and again a label... If I write the name of a person in
the TextBox and clicks the Button the program should find that person in the
database and show all adress details on the label...
I know that both are related, but I really couldn't find anything about it
on the internet... I have read that the recordsets/records/fields are
changed into .Item, but I couldn't find any detailed information about it,
just as I couldn't find any information about GetString (see code above...?)
I am not expecting that you solve my problems, but I hope that you can point
me in the right direction...
Thanks in advance for all your help.
Regards,
BY