I have a show button.The user will select a data from the dropdown list of the combo and on clicking the show button the corresponding data will be fetched from the database and will be shown in the corresponding fields.
So I did this code:
i get this error:Code:Private Sub Show_Btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Show_Btn.Click Using connection As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=BankAccount.mdb") connection.Open() Dim command As New OleDbCommand("Select * from BankAccount", connection) Dim reader As OleDbDataReader = command.ExecuteReader() While reader.Read() ComboBox1.Items.Add(reader.GetString("BankName")) ComboBox2.Items.Add(reader.GetString("AccountNo")) ComboBox3.Items.Add(reader.GetString("BankName")) ComboBox4.Items.Add(reader.GetString("AccountNo")) End While reader.Close() End Using End Sub
Code:Conversion from string "BankName" to type 'Integer' is not valid.




Reply With Quote