<%@ Language=VBScript%> <% dim strpagecode strpagecode= "FAIRG03" session("usertype")="SUS" %> <% dim strName strName = "" strName = trim(request.Form("description")) dim objrs, nextval,objrssql set objrs = server.createobject("ADODB.RecordSet") 'First of all, check for the existance of the Description in the table, if it already 'exists then disallow the addition. objrssql = " select categoryid from AvailableToCatgMaster where " & _ " Upper(ltrim(rtrim(description))) = '" & Ucase(strName) & "'" on error resume next objrs.open objrssql, objConn if err <> 0 then response.Redirect "/inc/admin/error.asp?errortype=err_record§ion="&server.URLEncode("Hall Registration") Response.End end if if (objrs.EOF and objrs.BOF ) then objrssql = "select 'nextval'=max(categoryid) from AvailableToCatgMaster" on error resume next set objrs = objConn.execute(objrssql) if err <> 0 then response.Redirect "/inc/admin/error.asp?errortype=err_record§ion="&server.URLEncode("Hall Registration") Response.End end if if (objrs.eof and objrs.bof) then nextval = 1 else if isNULL(objrs("nextval")) then nextval = 1 else nextval = Cdbl(objrs("nextval")) + 1 end if end if dim strinsert dim rs dim strIsIndian dim strCreateUserId dim strCreateDate strIsIndian = "" strCreateUserId = "" strCreateDate = "" if trim(request.Form("chkIndian")) = "on" then strIsIndian = "Y" else strIsIndian = "N" end if strCreateUserId = trim(Session("userid")) strCreateDate = now() strinsert = "" set rs = server.CreateObject("adodb.recordset") strinsert = " Insert into availableTocatgMaster (CategoryId, Description, IsIndian, " & _ " CreateUserId, createDate,Active) values(" & nextval & ",'" & strName & _ "','" & strIsIndian & "','" & 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=ACD§ion="&server.URLEncode("Hall Registration") Response.End end if %>