|
Someone please help! I've been working on a project for work for sometime now and still can't get it to function properly. I created this form which calls an access database to gather request information from users. Using asp,this form should lookup fields in the database, populate the form, sent out an email to users when submitted, and then insert their requests in an issues table when done. Everything works great accept for the insert part. I honesty don't believe my code is the culpret, I'm assuming it has something to do with setting permissions in IIS. I am currently running Windows XP and IIS 5.0. For testing purposes, I am using my labtop as the webserver. All files are being stored locally in my wwwroot folder. Below is the code for my form and the asp which is called on submittion. Any help on this issue would be greatly appreciate. Please let me know if further explanation is needed. Thanks in advance.
Note: Using DSN-Less Connection method. This file (db) is used to specify the path:
<% '-- Include file for database -- ' Const DatabasePath = "C:\Inetpub\wwwroot\Pid\IS_Issue_DB.mdb" %>
Form Code:
<%@ Language=VBScript %>
<% Response.Buffer = Test %> <!-- #include file="db.asp" -->
<% Dim oConn1 Dim oRs1 Dim strSQL
myDSN="Driver={Microsoft Access Driver (*.mdb)};;Dbq=" & DatabasePath & ";"
Set oConn1 = Server.CreateObject("ADODB.Connection") Set oRs1 = Server.CreateObject("ADODB.Recordset") oConn1.Open myDSN
strSQL = "SELECT * " strSQL = strSQL & "FROM Users ORDER BY Name" oRs1.Open strSQL, oConn1
userid = userid & "<OPTION SELECTED VALUE=""""></OPTION>" WHILE NOT oRs1.EOF userid = userid & "<OPTION VALUE="""& oRs1.Fields("OperatorID") & """>" & oRs1.Fields("Name") & "</OPTION>" 'userid = userid & "<option>" & oRs("OperatorID") & "</option>" oRs1.MoveNext WEND
oRs1.Close SET oRS1 = Nothing oConn1.Close SET oConn1 = Nothing %>
<% myDSN="Driver={Microsoft Access Driver (*.mdb)};;Dbq=" & DatabasePath & ";"
Set oConn1 = Server.CreateObject("ADODB.Connection") Set oRs1 = Server.CreateObject("ADODB.Recordset") oConn1.Open myDSN
strSQL = "SELECT * " strSQL = strSQL & "FROM Location ORDER BY Office" oRs1.Open strSQL, oConn1
location = location & "<OPTION SELECTED VALUE=""""></OPTION>" WHILE NOT oRs1.EOF location = location & "<OPTION VALUE="""& oRs1.Fields("id") & """>" & oRs1.Fields("Office") & "</OPTION>" 'userid = userid & "<option>" & oRs("OperatorID") & "</option>" oRs1.MoveNext WEND
oRs1.Close SET oRS1 = Nothing oConn1.Close SET oConn1 = Nothing %>
<% myDSN="Driver={Microsoft Access Driver (*.mdb)};;Dbq=" & DatabasePath & ";"
Set oConn1 = Server.CreateObject("ADODB.Connection") Set oRs1 = Server.CreateObject("ADODB.Recordset") oConn1.Open myDSN
strSQL = "SELECT * " strSQL = strSQL & "FROM DB_Branch ORDER BY Branch" oRs1.Open strSQL, oConn1
branch = branch & "<OPTION SELECTED VALUE=""""></OPTION>" WHILE NOT oRs1.EOF branch = branch & "<option value=" & oRs1("ID") & ">" & oRs1("Branch") & "</option>" oRs1.MoveNext WEND
oRs1.Close SET oRS1 = Nothing oConn1.Close SET oConn1 = Nothing %>
<% myDSN="Driver={Microsoft Access Driver (*.mdb)};;Dbq=" & DatabasePath & ";"
Set oConn1 = Server.CreateObject("ADODB.Connection") Set oRs1 = Server.CreateObject("ADODB.Recordset") oConn1.Open myDSN
strSQL = "SELECT * " strSQL = strSQL & "FROM Category ORDER BY Category" oRs1.Open strSQL, oConn1
category = category & "<OPTION SELECTED VALUE=""""></OPTION>" WHILE NOT oRs1.EOF category = category & "<option value=" & oRs1("ID") & ">" & oRs1("Category") & "</option>" oRs1.MoveNext WEND
oRs1.Close SET oRS1 = Nothing oConn1.Close SET oConn1 = Nothing %>
<% myDSN="Driver={Microsoft Access Driver (*.mdb)};;Dbq=" & DatabasePath & ";"
Set oConn1 = Server.CreateObject("ADODB.Connection") Set oRs1 = Server.CreateObject("ADODB.Recordset") oConn1.Open myDSN strSQL = "SELECT * " strSQL = strSQL & "FROM Severity ORDER BY Severity_Desc" oRs1.Open strSQL, oConn1
severity = severity & "<OPTION SELECTED VALUE=""""></OPTION>" WHILE NOT oRs1.EOF severity = severity & "<option value=" & oRs1("Level") & ">" & oRs1("Severity_Desc") & "</option>" oRs1.MoveNext WEND
oRs1.Close SET oRS1 = Nothing oConn1.Close SET oConn1 = Nothing %>
<html> <head> <title>On-Line Help Desk</title> <meta name="Microsoft Theme" content="canvas 011"> <!-- Load external JavaScript --> <script language="JavaScript" src="cookies.js"> </script> <!-- End load external JavaScript --> <script language="JavaScript"> <!-- var n; var p; var p1; function ValidatePhone(){ p=p1.value if(p.length==3){ //d10=p.indexOf('(') pp=p; d4=p.indexOf('(') d5=p.indexOf(')') if(d4==-1){ pp="("+pp; } if(d5==-1){ pp=pp+")"; } //pp="("+pp+")"; document.form2.Phone.value=""; document.form2.Phone.value=pp; } if(p.length>3){ d1=p.indexOf('(') d2=p.indexOf(')') if (d2==-1){ l30=p.length; p30=p.substring(0,4); //alert(p30); p30=p30+")" p31=p.substring(4,l30); pp=p30+p31; //alert(p31); document.form2.Phone.value=""; document.form2.Phone.value=pp; } } if(p.length>5){ p11=p.substring(d1+1,d2); if(p11.length>3){ p12=p11; l12=p12.length; l15=p.length //l12=l12-3 p13=p11.substring(0,3); p14=p11.substring(3,l12); p15=p.substring(d2+1,l15); document.form2.Phone.value=""; pp="("+p13+")"+p14+p15; document.form2.Phone.value=pp; //obj1.value=""; //obj1.value=pp; } l16=p.length; p16=p.substring(d2+1,l16); l17=p16.length; if(l17>3&&p16.indexOf('-')==-1){ p17=p.substring(d2+1,d2+4); p18=p.substring(d2+4,l16); p19=p.substring(0,d2+1); //alert(p19); pp=p19+p17+"-"+p18; document.form2.Phone.value=""; document.form2.Phone.value=pp; //obj1.value=""; //obj1.value=pp; } } //} setTimeout(ValidatePhone,100) } function getIt(m){ n=m.name; //p1=document.forms[0].elements[n] p1=m ValidatePhone() } function testphone(obj1){ p=obj1.value //alert(p) p=p.replace("(","") p=p.replace(")","") p=p.replace("-","") p=p.replace("-","") //alert(isNaN(p)) if (isNaN(p)==true){ alert("Check phone"); return false; } }
// Declaring valid date character, minimum year and maximum year var dtCh= "/"; var minY
|