Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PLEASE HELP!!- URGENT

Status
Not open for further replies.

janise

Technical User
May 25, 2003
161
US
I posted this last friday and some good folks tried to help.
It is still not working.,
I am basically trying to insert data into both the driver table and the police table.
Data gets inserted correctly into the driver table but nothing is inserting into the police table.
I can't figure this out.
Below is the entire code.
thanks in advance::

<%@ Language=VBScript%>
<%Response.buffer=true%>

<html>
<head>
<title>Untitled</title>
</head>

<body>

<%
Set connectionToDatabase=Server.CreateObject(&quot;ADODB.Connection&quot;)
Set recordSet=Server.CreateObject(&quot;ADODB.Recordset&quot;)
connectionToDatabase.Open &quot;DSN=janise&quot;


recordSet.Open &quot;SELECT * FROM Driver&quot;,connectionToDatabase,3,3

Dim ss_nbr, fname, validate
validate=true

for each qryItem in Request.Form
if Request.Form(qryItem) = &quot;&quot; Then
validate = false
Response.Write(&quot;Missing : &quot; & qryItem & &quot;<BR>&quot;)
End if
next

if not validate then
Response.Write(&quot;<body bgcolor=steelblue><BR><font color=red><h3><b>&quot; &_
&quot;Please click the back button and complete the missing fields. &quot; &_
&quot;Thank You</b></h3></font></body> &quot;)
else

recordSet.AddNew

recordSet(&quot;DriverID&quot;) = Request.Form(&quot;SS_NUM&quot;)
recordSet(&quot;lname&quot;) = Request.Form(&quot;LAST_NAME&quot;)
recordSet(&quot;fname&quot;) = Request.Form(&quot;FIRST_NAME&quot;)
recordSet(&quot;MI&quot;) = Request.Form(&quot;Middle_Initial&quot;)
recordSet(&quot;DriverGender&quot;) = Request.Form(&quot;Driver_Sex&quot;)
recordSet(&quot;Address1&quot;) = Request.Form(&quot;Address1&quot;)
recordSet(&quot;Address2&quot;) = Request.Form(&quot;Address2&quot;)
recordSet(&quot;CityAdd&quot;) = Request.Form(&quot;City&quot;)
recordSet(&quot;StateAdd&quot;) = Request.Form(&quot;STATE&quot;)
recordSet(&quot;ZipAdd&quot;) = Request.Form(&quot;ZIP_CODE&quot;)
recordSet(&quot;PhoneHome&quot;) = Request.Form(&quot;Home_Phone&quot;)
recordSet(&quot;PhoneWork&quot;) = Request.Form(&quot;Work_Phone&quot;)
recordSet(&quot;EmailAdd&quot;) = Request.Form(&quot;Email_Address&quot;)
recordSet(&quot;Result&quot;) = Request.Form(&quot;reason&quot;)
recordSet(&quot;drugTest&quot;) = Request.Form(&quot;drugTest&quot;)
recordSet(&quot;atFault&quot;) = Request.Form(&quot;atFault&quot;)
recordSet(&quot;DriverCond&quot;) = Request.Form(&quot;DriverCond&quot;)
recordSet(&quot;InjuryType&quot;) = Request.Form(&quot;InjuryType&quot;)
recordSet(&quot;WeatherType&quot;) = Request.Form(&quot;WeatherCond&quot;)
recordSet.Update


connectionToDatabase.Close
Set connectionToDatabase=Nothing

if Request.Form(&quot;CoApp&quot;) = &quot;NO&quot; Then
Response.Redirect &quot;co_applicant.asp?ss_nbr=&quot; & Request.Form(&quot;SS_NUM&quot;)
else
Response.Redirect &quot;new_rec.asp&quot;
end if


end if


%>


<%

'Set recordSet=Server.CreateObject(&quot;ADODB.Recordset&quot;)
Set recordSet2=Server.CreateObject(&quot;ADODB.Recordset&quot;)

recordSet2.Open &quot;SELECT * FROM Police&quot;,connectionToDatabase,3,3



for each qryItem in Request.Form
if Request.Form(qryItem) = &quot;&quot; Then
validate = false
Response.Write(&quot;Missing : &quot; & qryItem & &quot;<BR>&quot;)
End if
next

if not validate then
Response.Write(&quot;<body bgcolor=steelblue><BR><font color=red><h3><b>&quot; &_
&quot;Please click the back button and complete the missing fields. &quot; &_
&quot;Thank You</b></h3></font></body> &quot;)
else

recordSet2.AddNew

recordSet2(&quot;PoliceID&quot;) = Request.Form(&quot;code&quot;)
recordSet2(&quot;offFname&quot;) = Request.Form(&quot;F_NAME&quot;)
recordSet2(&quot;offLname&quot;) = Request.Form(&quot;L_NAME&quot;)
recordSet2(&quot;AccidentType&quot;) = Request.Form(&quot;acType&quot;)
recordSet2.Update



recordSet2.Close
Set recordSet2 = Nothing
end if

%>
</body>
</html>
 
is the above code all one the same page? if so, then at the least the police table is not getting updated because you response.redirect before getting to that section of code...

Code:
 if Request.Form(&quot;CoApp&quot;) = &quot;NO&quot; Then
        Response.Redirect &quot;co_applicant.asp?ss_nbr=&quot; & Request.Form(&quot;SS_NUM&quot;)
    else
        Response.Redirect &quot;new_rec.asp&quot;
    end if

glenn
 
how do you suggest that i handle it then?
i tried moving the if statement around but i am getting all types of errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top