0

I keep getting this error Missing semicolon (;) at end of SQL statement. when I run this code:

Dim cmd3 As OleDbCommand = New OleDbCommand("INSERT INTO Tickers (Quarter_Balance_Sheets) VALUES (Scrapalbe) WHERE Ticker = A;", con)
cmd3.ExecuteNonQuery()

What am I doing wrong?

gromit1
  • 577
  • 2
  • 14
  • 36

3 Answers3

4

Edited..

Sorry. After reading again you cannot use WHERE on an INSERT statement, loose the WHERE clause or make an UPDATE statement.

INSERT INTO ... WHERE is not a valid query.

If the insert you've posted has correct values and columns, the update should be:

Dim cmd3 As OleDbCommand = New OleDbCommand("UPDATE Tickers SET Quarter_Balance_Sheets = 'Scrapalbe' WHERE Ticker = 'A';", con)
cmd3.ExecuteNonQuery()
Esselans
  • 1,540
  • 2
  • 24
  • 44
3

Missing quotes WHERE Ticker = 'A' and in VALUES ('Scrapalbe')

edit: @Engerlost is right, where is not applicable to insert; you still need quotes but drop where... completely

Konstantin
  • 3,254
  • 15
  • 20
0

the problem in your query is you're using where in your insert statement.

the query is,

insert into Tablename (val1, val2, ...) values(val1, val2,....)
SMHasnain
  • 696
  • 4
  • 13