this is the code that will open a page "duplication_bn.
asp" if there is a duplication in the submitted form!
i have set 3 primary key to my database!
- Code: Select all
<% On Error Resume Next %>
- Code: Select all
<%
set bn = Server.CreateObject("ADODB.Recordset")
bn.ActiveConnection = MM_bn_STRING
bn.Source = "SELECT * FROM BN"
bn.CursorType = 0
bn.CursorLocation = 2
bn.LockType = 3
bn.Open()
bn_numRows = 0
If Err.number <> 0 then
Response.Redirect "duplication_bn.asp"
End If
%>
this code will open the page "go_here_after_submit_bn.
asp" after the user submit the form!
- Code: Select all
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) <> "") Then
MM_editConnection = MM_bn_STRING
MM_editTable = "BN"
MM_editRedirectUrl = "go_here_after_submit_bn.asp"
MM_fieldsStr = "bnRoom|value|bnTime|value|bnDay|value|bnSubject|value|bnSection|value"
MM_columnsStr = "bnRoom|',none,''|bnTime|',none,''|bnDay|',none,''|bnSubject|',none,''|bnSection|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
the problem is, i cannot use both of this code together!
when i use both of them, the "on error resume" next will not be functioning!
what i want is, when there is a duplication in my database, the "duplication_bn.
asp" will be display
(using on error resume next),
and when the submitted form dont have any duplication, then open "go_here_after_submit_bn.
asp"
any idea?