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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL insert problem

Status
Not open for further replies.

benniesanders

Programmer
Jan 20, 2002
199
US
Hi everybody,

I will preface this post with "This is new to me!". I've been raked
through the coals in DevDex before for asking elementary questions, so
I'm feeling a bit inadequate right now.

I am trying to insert data into a table using the following code:

strSQL2 = "select custid,productid,qty,priceperunit,session from holding
where session='"& sessionid &"'"
db.Execute(strSQL2)
set oRsTemp=db.execute(strSQL2)
Do until oRsTemp.EOF
strSQL = "insert into holding
(custid,productid,qty,priceperunit,session)
values('"&session("custid")&"','"&rscart("productid")&"','"& acart(i,1)
&"'," & currentprice & ",'" & sessionid & "');"
db.Execute(strSQL)
oRsTemp.MoveNext
Loop

However, it's not inserting the data. I think it could possibly work
because I used "do while" instead of "do until" and it entered the first
record but gave me the following error message:

ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted; the
operation requested by the application requires a current record.

/functions.asp, line 351

I don't know what to do. I've been trying to make this work since last
night. I'd greatly appreciate any help or direction.

Thanks.
 
I think you possibly made it too complicated. Try this:

if acart(i,0)<>&quot;&quot; and acart(i,1)<>&quot;&quot; then
strSQL = &quot;insert into holding (custid,productid,qty,priceperunit,session) values('&quot;&session(&quot;custid&quot;)&&quot;','&quot;&rscart(&quot;productid&quot;)&&quot;','&quot;& acart(i,1) &&quot;',&quot; & currentprice & &quot;,'&quot; & sessionid & &quot;');&quot;
db.Execute(strSQL)
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top