I got table1 with the columns ID, Name and IP. Can I fetch a name from the database (depending on ID) and show it as the text on a button when the form loads?
Something like
VB Code:
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source= " & System.AppDomain.CurrentDomain.BaseDirectory & "\db1.mdb" Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString) Dim queryString As String = "SELECT Name FROM table WHERE ID = '2'" Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand dbCommand.CommandText = queryString dbCommand.Connection = dbConnection Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter dataAdapter.SelectCommand = dbCommand Dim dataSet As System.Data.DataSet = New System.Data.DataSet buttonConf1.Text = dataSet.ToString
which sets the text on the button to System.Data.DataSet...
so how should it all actually look like?
if the code is completely wrong could you tell me how it should be please





Reply With Quote