質問

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