Hi.
I'm completely new to
VB.Net and v. limited in
VB!
Can someone point give me a simple piece of code to read data from several tables in a db called SUBMAN into a Dataset and transfer that to a textbox?
thanks in advance.
Here's as far as I've got!
Private Sub btnCountry_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCountry.Click
Dim DS As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection
' connect to the database
MyConnection = New OleDbConnection( _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "c:\DB\SUBMAN.mdb" & ";")
MyConnection.Open()
Dim sqlstring As String
' create the sqlstring ---- how do I get the command to use it?
sqlstring = "SELECT title, firstname, lastname, email, town, postcode, country"
sqlstring &= " FROM SUBSCRIBERS, ADDRESSES WHERE country = " & "'" & ComboCountry.Text & "'"
DS = New System.Data.DataSet()
MyCommand.Fill(DS)
MyConnection.Close()
'process each row
' Clear the variable
'get the data in each column
' remove trailing coma
' Write the data to the text box
txtResults.Text &= ' datafrom dataset
' close the conection and clean up
MyConnection.Close()
MyConnection.Dispose()
MyConnection = Nothing
DS.Dispose()
DS = Nothing
MyCommand.Dispose()
MyCommand = Nothing
End Sub