944,192 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 6670
  • MySQL RSS
Feb 16th, 2006
0

Unable to insert data into database.

Expand Post »
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


<% 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??
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
screwrup is offline Offline
2 posts
since Feb 2006
Feb 17th, 2006
0

Re: Unable to insert data into database.

well to start off with, you are passing recaffected as a parameter to conn.execute, but you never set it to any value
Reputation Points: 14
Solved Threads: 19
Posting Pro in Training
campkev is offline Offline
484 posts
since Jul 2005
Feb 23rd, 2006
0

Re: Unable to insert data into database.

ok dude.. . email me.. .lets fix this... i understand your problem but i really dont wanna type out the code
Reputation Points: 10
Solved Threads: 1
Newbie Poster
conspiringfate is offline Offline
21 posts
since Feb 2006
Feb 23rd, 2006
0

Re: Unable to insert data into database.

Quote originally posted by conspiringfate ...
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...
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Feb 23rd, 2006
0

Re: Unable to insert data into database.

I'm a SHE aniwae..
Reputation Points: 10
Solved Threads: 0
Newbie Poster
screwrup is offline Offline
2 posts
since Feb 2006
Feb 23rd, 2006
0

Re: Unable to insert data into database.

waits for email! lol
Reputation Points: 10
Solved Threads: 1
Newbie Poster
conspiringfate is offline Offline
21 posts
since Feb 2006
Feb 25th, 2006
0

Re: Unable to insert data into database.

Quote originally posted by conspiringfate ...
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.
DMR
Team Colleague
Reputation Points: 221
Solved Threads: 369
Wombat At Large
DMR is offline Offline
6,439 posts
since Dec 2003

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: Java Connection
Next Thread in MySQL Forum Timeline: Appeal by shameless newbie - Mandrake 10 + MySQL 5





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC