I am new to vb. I am trying to get a value for a textbox from a database according to the selected item in combobox. but i had this ex.message
Operator '&' in not defined for string "select*from ......" and type 'dtarowview'
Could anyone please tell me what is wrong with the following code?
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim connstrg As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Documents and Settings\hedris\My Documents\REGISTER.mdb;"
Dim conn As New OleDbConnection(connstrg)
Try
conn.Open()
Dim DA1 As New OleDbDataAdapter("select* FROM CLARUS where product=" & ComboBox1.SelectedItem & "", conn)
Dim ds1 As New DataSet
Dim dt As New DataTable
DA1.Fill(ds1, "clarus")
dt = ds1.Tables("clarus")
conn.Close()
TextBox1.Text = dt.Rows.Item(0).Item(0)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub