Вопрос

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?

Это было полезно?

Решение

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()

Другие советы

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

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,....)
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top