Hi guys, i hope u can help me solve this prob of mine. Im currently werking on this project and somehow im unable to insert this data into my database eventhough the data was being retrieved. Can anione help :sad:


<% option explicit %>
<% response.buffer = true %>

<%

Dim conn, recaffected, sql, qty, increment, updated, objRS, objRS2, name, productid

qty=1

increment=0
updated=0

set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("dbProduct.mdb"))

set objRS = Server.CreateObject("ADODB.recordset")
set objRS2 = Server.CreateObject("ADODB.recordset")

objRS.Open "SELECT * FROM OrderTable WHERE shopperid=" & session("shopperid")" , conn
objRS2.Open "SELECT * FROM Product WHERE productid=" & request.querystring("productid"), conn


sql="INSERT INTO OrderTable(shopperid, productid, qty, increment, updated, pdt, startbid1)"
sql=sql & " VALUES "
sql=sql & "(" & session("shopperid") & ", "
sql=sql & objRS2("productid") & ", "
sql=sql & qty & ", "
sql=sql & increment & ", "
sql=sql & updated & ", "
sql=sql & objRS2("name") & ", "
sql=sql & objRS2("startbid") & ") "

on error resume next
response.Write(sql)
response.end
conn.Execute sql, recaffected
if err<>0 then
response.write("<br>Product is already included, <a href='desc2.asp'>try again</a>.")
else
response.redirect("buy2.asp")
end if


objRS.close
objRS2.close

conn.close

%>


Is it bcos of the session??

Recommended Answers

All 6 Replies

well to start off with, you are passing recaffected as a parameter to conn.execute, but you never set it to any value

ok dude.. . email me.. .lets fix this... i understand your problem but i really dont wanna type out the code

ok dude.. . email me.. .lets fix this... i understand your problem but i really dont wanna type out the code

Why not help her solve the problem here? If so then everyone else will have the opportunity to see the solution and learn something...

I'm a SHE aniwae.. :)

waits for email! lol

Please read our posting rules regarding requesting and/or offering help via any channels other than the forums. In accordance with those rules, please refrain from offering such assistance here in the future.

Thanks in advance for understanding.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.