On Error Resume

Results 1 to 2 of 2

Thread: On Error Resume

  1. #1
    Steve P Guest

    Default On Error Resume

    This code is giving me errors even if it is able to write to the database:<BR><BR><BR>On Error resume next<BR>Set MyConn = Server.CreateObject("ADODB.Connection")<BR>MyConn. Open "DRIVER=Microsoft Access Driver " & "(*.mdb);UID=admin;FIL=MS Access;DBQ=" & Server.MapPath("Criteria.mdb")<BR><BR>if c1 = "on" then<BR> SQL_query = "INSERT INTO PCriteria (ProjectName,ProjectCriteria) VALUES (&#039;" & ProjectName & "&#039;,&#039;MachineName&#039;)"<BR><BR> Set RS = MyConn.Execute(SQL_query)<BR> <BR> if Err.number &#060;&#062; 0 then<BR> Response.Cookies("Software") = "MachineName"<BR> Response.Cookies("ProjectName") = ProjectName<BR> Response.Redirect "Error.asp"<BR> end if<BR><BR>end if <BR><BR> <BR>What am I doing wrong....My DB does not allow for Dupes, So I want to send the user to another page if they try to enter a dupe????

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default RE: On Error Resume

    I have no clue what you are trying here<BR><BR>please post your error message <BR><BR>if you need to check for duplicates you have to do it BEFORE you insert...select and check for duplicates if there are none then insert else redirect<BR><BR>

Posting Permissions

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