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!

Blank data entered into database HELP!!!

Status
Not open for further replies.

gmagerr

Technical User
Aug 11, 2001
323
US
Hi guys, I was having trouble with a form, it's entering data into 4 seperate tables in my database. I had to figure out a way to check the form values to make sure there was data before submitting to the database (tables) ok i successfully figured that out, but now i'm having another problem. When i submit the form with no data (for testing) i get an error saying "Expected End line 204" i can't figure it out. I'll post the code. any help would be greatly appreciated...


<%@ LANGUAGE=&quot;VBSCRIPT&quot; %>
<%
Option Explicit
Response.Buffer = True
Response.ContentType = &quot;text/html; charset=iso-8859-1&quot;
'--------------------------------------------------------------
'--- Module: .asp
'---
'--- Version: 1.0
'---
'--- Purpose:
'---
'--- Dependencies:
'---
'--- Notes:
'---
'--- Author: Gene Magerr genemagerr@hotmail.com
'--- Copyright 2001 Magerr Media all rights reserved
'--------------------------------------------------------------
%><!--#include file=&quot;../../adovbs.inc&quot;--><%
'--------------------------------------------------------------
Dim rsComp, rsTester, rsTools, rsVehicle, cnTelmon
'--------------------------------------------------------------
'--- Insert into table Computers
'--------------------------------------------------------------
Set cnTelmon = Server.CreateObject(&quot;ADODB.Connection&quot;)
cnTelmon.Open &quot;DSN=Telmon&quot;

Set rsComp = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsComp.Open &quot;Computers&quot;, cnTelmon, adOpenStatic, adLockOptimistic

If Request.Form(&quot;compSerialNo&quot;) <> &quot;&quot; Then
rsComp.AddNew
rsComp(&quot;SerialNo&quot;) = Request.Form(&quot;compSerialNo&quot;)
End If
If Request.Form(&quot;CompDescription&quot;) <> &quot;&quot; Then
rsComp.AddNew
rsComp(&quot;Description&quot;) = Request.Form(&quot;compDescription&quot;)
End if
If Request.Form(&quot;compIssuedTo&quot;) <> &quot;&quot; Then
rsComp.AddNew
rsComp(&quot;IssuedTo&quot;) = Request.Form(&quot;compIssuedTo&quot;)
End If
If Request.Form(&quot;compDateIssued&quot;) <> &quot;&quot; Then
rsComp.AddNew
rsComp(&quot;DateIssued&quot;) = Request.Form(&quot;compDateIssued&quot;)
End if
If Request.Form(&quot;compNotes&quot;) <> &quot;&quot; Then
rsComp.AddNew
rsComp(&quot;Notes&quot;) = Request.Form(&quot;compNotes&quot;)
End If

rsComp.Update
rsComp.MoveLast

rsComp.Close
Set rsComp = Nothing

'--------------------------------------------------------------
'--- Insert into table Testers
'--------------------------------------------------------------

Set rsTester = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsTester.Open &quot;Testers&quot;, cnTelmon, adOpenStatic, adLockOptimistic

If Request.Form(&quot;testerSerialNo&quot;) <> &quot;&quot; Then
rsTester.AddNew
rsTester(&quot;SerialNo&quot;) = Request.Form(&quot;testerSerialNo&quot;)
End If
If Request.Form(&quot;testerTester&quot;) <> &quot;&quot; Then
rsTester.AddNew
rsTester(&quot;Tester&quot;) = Request.Form(&quot;testerTester&quot;)
End if
If Request.Form(&quot;testerIssuedTo&quot;) <> &quot;&quot; Then
rsTester.AddNew
rsTester(&quot;IssuedTo&quot;) = Request.Form(&quot;testerIssuedTo&quot;)
End If
If Request.Form(&quot;testerDateIssued&quot;) <> &quot;&quot; Then
rsTester.AddNew
If Request.Form(&quot;testerDateIssued&quot;) <> &quot;&quot; Then
rsTester.AddNew
rsTester(&quot;DateIssued&quot;) = Request.Form(&quot;testerDateIssued&quot;)
End If
If Request.Form(&quot;testerDownloaded&quot;) <> &quot;&quot; Then
rsTester.AddNew
rsTester(&quot;Downloaded&quot;) = Request.Form(&quot;testerDownloaded&quot;)
End If
If Request.Form(&quot;testerFlashed&quot;) <> &quot;&quot; Then
rsTester.AddNew
rsTester(&quot;Flashed&quot;) = Request.Form(&quot;testerFlashed&quot;)
End If
If Request.Form(&quot;testerNotes&quot;) <> &quot;&quot; Then
rsTester.AddNew
rsTester(&quot;Notes&quot;) = Request.Form(&quot;testerNotes&quot;)
End If

rsTester.Update
rsTester.MoveLast

rsTester.Close
Set rsTester = Nothing

'--------------------------------------------------------------
'--- Insert into table Vehicles
'--------------------------------------------------------------

Set rsVehicle = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsVehicle.Open &quot;Vehicles&quot;, cnTelmon, adOpenStatic, adLockOptimistic

If Request.Form(&quot;vehicleLicense&quot;) <> &quot;&quot; Then
rsVehicle.AddNew
rsVehicle(&quot;License&quot;) = Request.Form(&quot;vehicleLicense&quot;)
End If
If Request.Form(&quot;vehicleVehicle&quot;) <> &quot;&quot; Then
rsVehicle.AddNew
rsVehicle(&quot;Vehicle&quot;) = Request.Form(&quot;vehicleVehicle&quot;)
End If
If Request.Form(&quot;vehicleIssuedTo&quot;) <> &quot;&quot; Then
rsVehicle(&quot;IssuedTo&quot;) = Request.Form(&quot;vehicleIssuedTo&quot;)
End If
If Request.Form(&quot;vehicleDateIssued&quot;) <> &quot;&quot; Then
rsVehicle(&quot;DateIssued&quot;) = Request.Form(&quot;vehicleDateIssued&quot;)
End If
If Request.Form(&quot;vehicleMileage&quot;) <> &quot;&quot; Then
rsVehicle(&quot;Mileage&quot;) = Request.Form(&quot;vehicleMileage&quot;)
End If
If Request.Form(&quot;vehicleServiceNotes&quot;) <> &quot;&quot; Then
rsVehicle(&quot;ServiceNotes&quot;) = Request.Form(&quot;vehicleServiceNotes&quot;)
End If

rsVehicle.Update
rsVehicle.MoveLast

rsVehicle.Close
Set rsVehicle = Nothing

'--------------------------------------------------------------
'--- Insert into table Tools
'--------------------------------------------------------------

Set rsTools = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsTools.Open &quot;Tools&quot;, cnTelmon, adOpenStatic, adLockOptimistic

If Request.Form(&quot;toolsSerialNo&quot;) <> &quot;&quot; Then
rsTools.AddNew
rsTools(&quot;SerialNo&quot;) = Request.Form(&quot;toolsSerialNo&quot;)
End If
If Request.Form(&quot;toolsDescription&quot;) <> &quot;&quot; Then
rsTools.AddNew
rsTools(&quot;Description&quot;) = Request.Form(&quot;toolsDescription&quot;)
End If
If Request.Form(&quot;toolsIssuedTo&quot;) <> &quot;&quot; Then
rsTools.AddNew
rsTools(&quot;IssuedTo&quot;) = Request.Form(&quot;toolsIssuedTo&quot;)
End If
If Request.Form(&quot;toolsDateIssued&quot;) <> &quot;&quot; Then
rsTools.AddNew
rsTools(&quot;DateIssued&quot;) = Request.Form(&quot;toolsDateIssued&quot;)
End If
If Request.Form(&quot;toolsNotes&quot;) <> &quot;&quot; Then
rsTools.AdNew
rsTools(&quot;Notes&quot;) = Request.Form(&quot;toolsNotes&quot;)
End If

rsTools.Update
rsTools.MoveLast

rsTools.Close
Set rsTools = Nothing

Response.Redirect &quot;Inventory.asp&quot;

'--------------------------------------------------------------
'--- Initialization
'--------------------------------------------------------------

'--------------------------------------------------------------
'--- Body
'--------------------------------------------------------------

'--------------------------------------------------------------
'--- Begin HTML output
'--------------------------------------------------------------
%>
<HTML>
<HEAD>
<TITLE>Untitled</TITLE>
</HEAD>

<BODY>

</BODY>
</HTML>
<%
'----------------------------------------------------------------------
'--- End HTML Output
'----------------------------------------------------------------------
cnTelmon.Close
Set cnTelmon = Nothing

'----------------------------------------------------------------------
'--- All ASP post processing code goes here, as well as
'--- sub routines and functions
'----------------------------------------------------------------------
%>


This is the page it goes to after you click submit on the form this checks for data and submits to the database.
Oh by the way, line 204 on my machine is the closing %> at the very bottom of the page. thanks in advance.
 
Copy and paste the entire error exactly please. Are you sure it didn't say expected &quot;End if&quot; -Phil
fillup07@hotmail.com
 
Here's the exact error

Microsoft VBScript compilation error '800a03f6'

Expected 'End'

/telmon/Intranet/Inventory/SubmitInventory.asp, line 204


Remember i'm submitting the form with no data to test the code i posted earlier. i tried to place an End If on line 204 but got the error expected object
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top