<% Option Explicit %> <% dim strpagecode strpagecode= "FAIRG01" session("usertype")="SUS" %> <% on error goto 0 dim strinsert dim rs dim nmProdId dim strProductName dim strCreateUserId dim strCreateDate dim strQry nmProdId = 0 strProductName = "" strCreateUserId = "" strCreateDate = "" strQry = "" nmProdId = Cdbl(trim(request.Form("productCode"))) strProductName = trim(request.Form("productdesc")) strCreateUserId = trim(Session("userid")) strCreateDate = now() set rs = Server.CreateObject("ADODB.RECORDSET") 'Before inserting the record for a Product Category, it has to be checked for duplicate 'Product Id / code. strQry = " Select count(ProdId) countr from Products_Master where ProdId = " & nmProdId on error resume next set rs = ObjConn.Execute(strQry) if err <> 0 then response.Redirect "/inc/admin/error.asp?errortype=err_record§ion="&server.URLEncode("Hall Registration") Response.End end if on error goto 0 If cint(rs("countr")) = 0 then strinsert = "Insert into Products_Master (ProdId, ProductName, CreateUserId, createDate,Active) values(" & nmProdId & ",'" & strProductName & _ "','" & strCreateUserId & "','" & strCreateDate & "','Y')" on error resume next ObjConn.Execute strinsert if err <> 0 then response.Redirect "/inc/admin/error.asp?errortype=err_record§ion="&server.URLEncode("Hall Registration") Response.End else Response.redirect "/inc/admin/confirm.asp?message=1§ion=" & Server.URLEncode("Hall Registration")& "&path=/fairregistration/admin" end if on error goto 0 else response.Redirect "/inc/admin/error.asp?errorno=DPC§ion="&server.URLEncode("Hall Registration") Response.End end if %>