Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Posts
    3

    Unanswered: 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




    %>

  2. #2
    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

    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




    %>

  3. #3
    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.




    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




    %>

  4. #4
    Join Date
    Jan 2004
    Posts
    3

    Talking Re: ASP Add new record

    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.

  5. #5
    Join Date
    Jan 2004
    Posts
    3

    Talking Re: ASP Add new record

    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.

  6. #6
    Join Date
    Jan 2004
    Posts
    11
    lol @ u "Bobby-2-times"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •