I'm doing a project in vb.net back-end is MSACCESS...
I don't know how to store data from COMBO BOX and to RETRIVE data from database to COMBO BOX...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Ariff\Inventory\Inventory.mdb;Persist Security Info=False")
cn.Open()
str = "insert into Sales values(" & TxtCde.Text & "," & TxtDate.Text & ",'" & CmbCtgry.SelectedItem & "'," & TxtDscnt.Text & "," & TxtQty.Text & "," & TxtDesc.Text & " )"
'string stores the command and CInt is used to convert number to string
cmd = New OleDbCommand(str, cn)
icount = cmd.ExecuteNonQuery
MessageBox.Show(icount)
'displays number of records inserted
Catch ex As Exception
MessageBox.Show(ex.Message & " - " & ex.Source)
'MsgBox("Connection Error")
cn.Close()
End Try
End Sub
The error is: Syntax error (missing operator) in query expression
Plz help me to solve this prob... i have to finish my project very soon...
Thanks in advance...