Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange error in INSERT statement

Status
Not open for further replies.

Herminio

Technical User
May 10, 2002
189
0
0
PT
I have this code :

<%
dim nome
dim coment
coment = request.form(&quot;com&quot;)
nome = request.form(&quot;nome&quot;)
id = request.querystring(&quot;id&quot;)

Set conn = Server.CreateObject(&quot;ADODB.connection&quot;)
strCon = &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & Server.MapPath(&quot;db/opiniao.mdb&quot;)
conn.open strcon
strOpin = &quot;insert into coments (Nome,Coment) values ('&quot;&nome&&quot;','&quot;&coment&&quot;') where idopiniao=&quot;&id;&quot;
conn.execute(strOpin)
%>

this is what's happening

for the first time the browser gave me an error saying that (;) is missing at the end of instruction, and now that the (;) is there it tells me &quot;expected end of instruction&quot;, can someone tell me what's wrong?

Thanks in advance

Herminio, Portugal
 
You can't have a WHERE clause in an INSERT statement. It looks like you are trying to update the row?:

Code:
strOpin = &quot;UPDATE coments SET nome = '&quot; & nome & &quot;', coment = '&quot; & coment & &quot;' WHERE idopiniao = &quot; & id
--James
 
ok, just forget it, i have to insert the idopiniao in the DB to.

Sorry for the time i've made you spend with this silly question.

Herminio, Portugal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top