If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > ASP Add new record

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-27-04, 05:09
Bobby0315 Bobby0315 is offline
Registered User
 
Join Date: Jan 2004
Posts: 3
ASP Add new record

I have searched the forum and tried a solution that was posted but I had no success. This code is meant to add new record to a database. When I run the code I get 2 records of the same record.

Any help that can be provided would be great!


here is my code....

<%

strconn = "Provider=Microsoft.Jet.OLEDB.4.0; " _
& "Data Source=E:\Webspace\resadmin\ed\tellop.mdb"

strSQL = "INSERT INTO Purchase_Order_Line_Items(PurchaseOrderNumber,Part Number,Quantity,UnitPrice)Values('" & Request.Form("T1") & "','" & Request.Form("T2") & "','" & Request.Form("T3") & "','" & Request.Form("T4") & "')"

set conn = Server.CreateObject("ADODB.Connection")
conn.open strconn

conn.execute(strSQL)
conn.close
set conn = nothing




%>
Reply With Quote
  #2 (permalink)  
Old 01-28-04, 06:04
anuLakhanpal anuLakhanpal is offline
Registered User
 
Join Date: Jan 2004
Posts: 1
Re: ASP Add new record

Hi,
I also faced the same problem.
In your code the page must be submitted twice check in your code.

Thanks

Quote:
Originally posted by Bobby0315
I have searched the forum and tried a solution that was posted but I had no success. This code is meant to add new record to a database. When I run the code I get 2 records of the same record.

Any help that can be provided would be great!


here is my code....

<%

strconn = "Provider=Microsoft.Jet.OLEDB.4.0; " _
& "Data Source=E:\Webspace\resadmin\ed\tellop.mdb"

strSQL = "INSERT INTO Purchase_Order_Line_Items(PurchaseOrderNumber,Part Number,Quantity,UnitPrice)Values('" & Request.Form("T1") & "','" & Request.Form("T2") & "','" & Request.Form("T3") & "','" & Request.Form("T4") & "')"

set conn = Server.CreateObject("ADODB.Connection")
conn.open strconn

conn.execute(strSQL)
conn.close
set conn = nothing




%>
Reply With Quote
  #3 (permalink)  
Old 01-28-04, 06:17
shvetak shvetak is offline
Registered User
 
Join Date: Jan 2004
Posts: 3
Re: ASP Add new record

You must be using an image for submitting the form
<input type = image .....> and defined an on-click event that agains submits the form. This way two records are being inserted.




Quote:
Originally posted by Bobby0315
I have searched the forum and tried a solution that was posted but I had no success. This code is meant to add new record to a database. When I run the code I get 2 records of the same record.

Any help that can be provided would be great!


here is my code....

<%

strconn = "Provider=Microsoft.Jet.OLEDB.4.0; " _
& "Data Source=E:\Webspace\resadmin\ed\tellop.mdb"

strSQL = "INSERT INTO Purchase_Order_Line_Items(PurchaseOrderNumber,Part Number,Quantity,UnitPrice)Values('" & Request.Form("T1") & "','" & Request.Form("T2") & "','" & Request.Form("T3") & "','" & Request.Form("T4") & "')"

set conn = Server.CreateObject("ADODB.Connection")
conn.open strconn

conn.execute(strSQL)
conn.close
set conn = nothing




%>
Reply With Quote
  #4 (permalink)  
Old 01-28-04, 09:17
Bobby0315 Bobby0315 is offline
Registered User
 
Join Date: Jan 2004
Posts: 3
Talking Re: ASP Add new record

Quote:
Originally posted by shvetak
You must be using an image for submitting the form
<input type = image .....> and defined an on-click event that agains submits the form. This way two records are being inserted.

Thank you so much, I never even thought to go look at the form that was passing the data!!! You are awesome.
Reply With Quote
  #5 (permalink)  
Old 01-28-04, 09:19
Bobby0315 Bobby0315 is offline
Registered User
 
Join Date: Jan 2004
Posts: 3
Talking Re: ASP Add new record

Quote:
Originally posted by anuLakhanpal
Hi,
I also faced the same problem.
In your code the page must be submitted twice check in your code.

Thanks

Thank you so much, I never even thought to go look at the form that was passing the data!!! You are awesome.
Reply With Quote
  #6 (permalink)  
Old 01-30-04, 12:00
da frog da frog is offline
Registered User
 
Join Date: Jan 2004
Posts: 11
lol @ u "Bobby-2-times"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On