Here is a code to insert data to DBaccess from textbox. When I write a colon(') in the textbox to add to DB it caused error and show me this Message "Syntax error in string in query expression '''')'
vb Code:
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data Source =" & Application.StartupPath & "\Store.mdb ") Dim cmd As New OleDbCommand cmd.Connection = conn 'Add text to DB cmd.CommandText = "INSERT INTO TBinMaterial(inMaterial) " & "values ('" & txtAddM.Text & "') " cmd.CommandType = CommandType.Text conn.Open() cmd.ExecuteNonQuery() conn.Close()




Reply With Quote