Unable to insert data into database.

Reply

Join Date: Feb 2006
Posts: 2
Reputation: screwrup is an unknown quantity at this point 
Solved Threads: 0
screwrup screwrup is offline Offline
Newbie Poster

Unable to insert data into database.

 
0
  #1
Feb 16th, 2006
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??
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Unable to insert data into database.

 
0
  #2
Feb 17th, 2006
well to start off with, you are passing recaffected as a parameter to conn.execute, but you never set it to any value
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 21
Reputation: conspiringfate is an unknown quantity at this point 
Solved Threads: 1
conspiringfate conspiringfate is offline Offline
Newbie Poster

Re: Unable to insert data into database.

 
0
  #3
Feb 23rd, 2006
ok dude.. . email me.. .lets fix this... i understand your problem but i really dont wanna type out the code
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: Unable to insert data into database.

 
0
  #4
Feb 23rd, 2006
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...
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2
Reputation: screwrup is an unknown quantity at this point 
Solved Threads: 0
screwrup screwrup is offline Offline
Newbie Poster

Re: Unable to insert data into database.

 
0
  #5
Feb 23rd, 2006
I'm a SHE aniwae..
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 21
Reputation: conspiringfate is an unknown quantity at this point 
Solved Threads: 1
conspiringfate conspiringfate is offline Offline
Newbie Poster

Re: Unable to insert data into database.

 
0
  #6
Feb 23rd, 2006
waits for email! lol
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 6,439
Reputation: DMR will become famous soon enough DMR will become famous soon enough 
Solved Threads: 363
Team Colleague
DMR's Avatar
DMR DMR is offline Offline
Wombat At Large

Re: Unable to insert data into database.

 
0
  #7
Feb 25th, 2006
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.
"May the Wombat of Happiness snuffle through your underbrush."
- Ancient Aborigine blessing


Please do not contact me by email or PM for help. We're all volunteers here, and only have so much free time to dedicate to our efforts.

However, if I've been working on a thread with you already, and seem to have "forgotten" your thread, please do send me a message. I try not to let things slip through the cracks, but it does happen sometimes.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC