Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Help!


Message #1 by "Staci Parrish" <sparrish@w...> on Wed, 14 Aug 2002 11:55:13 -0500
I'm getting the following error:
Error Type:
Microsoft VBScript compilation (0x800A03F2)
Expected identifier
/working/form_ac.asp, line 12, column 10
dim fname,
---------^

I hope someone can help!

Here is the code for the page in question:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<LINK title=master href="style.css" type=text/css rel=stylesheet>

</head>

<body>
<%
   ' Declaring variables
   	dim fname, lname, nname, gender, address1, address2, city, state, zip,
subdiv, birthday, grade, class, instype, slot, moname, faname, 	phone,
email, mophone1, faphone1, mophone2, faphone2, notify, notifymethod,
liveparent, comments, serialno, insbrand, lessons, 	instructor, insurance,
data_source, con, sql_insert

   ' A Function to check if some field entered by user is empty
   Function ChkString(string)
   If string = "" Then string = " "
   ChkString = Replace(string, "'", "''")
   End Function

   ' Receiving values from Form
  	fname = ChkString(Request.Form("fname"))
	lname = ChkString(Request.Form("lname"))
	nname = ChkString(Request.Form("nname"))
	gender = ChkString(Request.Form("gender"))
	address1 = ChkString(Request.Form("address1"))
	address2 = ChkString(Request.Form("address2"))
	city = ChkString(Request.Form("city"))
	state = ChkString(Request.Form("state"))
	zip = ChkString(Request.Form("zip"))
	subdiv= ChkString(Request.Form("subdiv"))
	birthday= ChkString(Request.Form("birthday"))
	grade = ChkString(Request.Form("grade"))
	class = ChkString(Request.Form("class"))
	instype = ChkString(Request.Form("instype"))
	slot = ChkString(Request.Form("slot"))
	moname = ChkString(Request.Form("moname"))
	faname = ChkString(Request.Form("faname"))
	phone = ChkString(Request.Form("phone"))
	email= ChkString(Request.Form("email"))
	mophone1 = ChkString(Request.Form("mophone1"))
	faphone1 = ChkString(Request.Form("faphone1"))
	mophone2 = ChkString(Request.Form("mophone2"))
	faphone2 = ChkString(Request.Form("faphone2"))
	notify = ChkString(Request.Form("notify"))
	notifymethod = ChkString(Request.Form("notifymethod"))
	liveparent= ChkString(Request.Form("liveparent"))
	comments = ChkString(Request.Form("comments"))
	serialno = ChkString(Request.Form("serialno"))
	insbrand = ChkString(Request.Form("insbrand"))
	lessons = ChkString(Request.Form("lessons"))
	instructor = ChkString(Request.Form("instructor"))
	insurance = ChkString(Request.Form("insurance"))
	data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
            Server.MapPath("form.mdb")

sql_insert = "insert into users (fname, lname, nname, gender, address1,
address2, city, state, zip, subdiv, birthday, grade, class, instype, slot,
moname, faname, phone, email, mophone1, faphone1, mophone2, faphone2,
notify, notifymethod, liveparent, comments, serialno, insbrand, lessons,
instructor, insurance)
	values
	('" & _ fname & "',
	'" & _ lname & "',
	'" & _ nname & "',
	'" & _ gender & "',
	'" & _ address1 & "',
	'" & _ address2 & "',
	'" & _ city & "',
	'" & _ state & "',
	'" & _ zip & "',
	'" & _ subdiv & "',
	'" & _ birthday & "',
	'" & _ grade & "',
	'" & _ class & "',
	'" & _ instype & "',
	'" & _ slot & "',
	'" & _ moname & "',
	'" & _ faname & "',
	'" & _ phone & "',
	'" & _ email & "',
	'" & _ mophone1 & "',
	'" & _ faphone1 & "',
	'" & _ mophone2 & "',
	'" & _ faphone2 & "',
	'" & _ notify & "',
	'" & _ notifymethod & "'	,
	'" & _ liveparent & "',
	'" & _ comments & "',
	'" & _ serialno & "',
	'" & _ insbrand & "',
	'" & _ lessons & "',
	'" & _ instructor & "',
	'" & _ insurance & "',)"

   ' Creating Connection Object and opening the database
   Set con = Server.CreateObject("ADODB.Connection")
   con.Open data_source
   con.Execute sql_insert
   ' Done. Close the connection
   con.Close
   Set con = Nothing
   Response.Write "Thank you for submitting your information."

 %>

<p>
<b><a href="index.html">Return</a></b>

</body>
</html>

Message #2 by "Daniel Groh" <daniel.groh@s...> on Wed, 14 Aug 2002 13:59:33 -0300
for each line it need of a Dim

dim fname, lname, nname, gender, address1, address2, city, state, zip,
dim subdiv, birthday, grade, class, instype, slot, moname, faname, phone,
dim email, mophone1, faphone1, mophone2, faphone2, notify, notifymethod,
dim liveparent, comments, serialno, insbrand, lessons, instructor,
insurance,
dim data_source, con, sql_insert

Hugs

Daniel, Brazilian guy

----- Original Message -----
From: Staci Parrish <sparrish@w...>
To: Access ASP <access_asp@p...>
Sent: Wednesday, August 14, 2002 1:55 PM
Subject: [access_asp] Help!


> I'm getting the following error:
> Error Type:
> Microsoft VBScript compilation (0x800A03F2)
> Expected identifier
> /working/form_ac.asp, line 12, column 10
> dim fname,
> ---------^
>
> I hope someone can help!
>
> Here is the code for the page in question:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
> <html>
> <head>
> <LINK title=master href="style.css" type=text/css rel=stylesheet>
>
> </head>
>
> <body>
> <%
>    ' Declaring variables
>    dim fname, lname, nname, gender, address1, address2, city, state, zip,
> subdiv, birthday, grade, class, instype, slot, moname, faname, phone,
> email, mophone1, faphone1, mophone2, faphone2, notify, notifymethod,
> liveparent, comments, serialno, insbrand, lessons, instructor, insurance,
> data_source, con, sql_insert
>
>    ' A Function to check if some field entered by user is empty
>    Function ChkString(string)
>    If string = "" Then string = " "
>    ChkString = Replace(string, "'", "''")
>    End Function
>
>    ' Receiving values from Form
>   fname = ChkString(Request.Form("fname"))
> lname = ChkString(Request.Form("lname"))
> nname = ChkString(Request.Form("nname"))
> gender = ChkString(Request.Form("gender"))
> address1 = ChkString(Request.Form("address1"))
> address2 = ChkString(Request.Form("address2"))
> city = ChkString(Request.Form("city"))
> state = ChkString(Request.Form("state"))
> zip = ChkString(Request.Form("zip"))
> subdiv= ChkString(Request.Form("subdiv"))
> birthday= ChkString(Request.Form("birthday"))
> grade = ChkString(Request.Form("grade"))
> class = ChkString(Request.Form("class"))
> instype = ChkString(Request.Form("instype"))
> slot = ChkString(Request.Form("slot"))
> moname = ChkString(Request.Form("moname"))
> faname = ChkString(Request.Form("faname"))
> phone = ChkString(Request.Form("phone"))
> email= ChkString(Request.Form("email"))
> mophone1 = ChkString(Request.Form("mophone1"))
> faphone1 = ChkString(Request.Form("faphone1"))
> mophone2 = ChkString(Request.Form("mophone2"))
> faphone2 = ChkString(Request.Form("faphone2"))
> notify = ChkString(Request.Form("notify"))
> notifymethod = ChkString(Request.Form("notifymethod"))
> liveparent= ChkString(Request.Form("liveparent"))
> comments = ChkString(Request.Form("comments"))
> serialno = ChkString(Request.Form("serialno"))
> insbrand = ChkString(Request.Form("insbrand"))
> lessons = ChkString(Request.Form("lessons"))
> instructor = ChkString(Request.Form("instructor"))
> insurance = ChkString(Request.Form("insurance"))
> data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
>             Server.MapPath("form.mdb")
>
> sql_insert = "insert into users (fname, lname, nname, gender, address1,
> address2, city, state, zip, subdiv, birthday, grade, class, instype, slot,
> moname, faname, phone, email, mophone1, faphone1, mophone2, faphone2,
> notify, notifymethod, liveparent, comments, serialno, insbrand, lessons,
> instructor, insurance)
> values
> ('" & _ fname & "',
> '" & _ lname & "',
> '" & _ nname & "',
> '" & _ gender & "',
> '" & _ address1 & "',
> '" & _ address2 & "',
> '" & _ city & "',
> '" & _ state & "',
> '" & _ zip & "',
> '" & _ subdiv & "',
> '" & _ birthday & "',
> '" & _ grade & "',
> '" & _ class & "',
> '" & _ instype & "',
> '" & _ slot & "',
> '" & _ moname & "',
> '" & _ faname & "',
> '" & _ phone & "',
> '" & _ email & "',
> '" & _ mophone1 & "',
> '" & _ faphone1 & "',
> '" & _ mophone2 & "',
> '" & _ faphone2 & "',
> '" & _ notify & "',
> '" & _ notifymethod & "' ,
> '" & _ liveparent & "',
> '" & _ comments & "',
> '" & _ serialno & "',
> '" & _ insbrand & "',
> '" & _ lessons & "',
> '" & _ instructor & "',
> '" & _ insurance & "',)"
>
>    ' Creating Connection Object and opening the database
>    Set con = Server.CreateObject("ADODB.Connection")
>    con.Open data_source
>    con.Execute sql_insert
>    ' Done. Close the connection
>    con.Close
>    Set con = Nothing
>    Response.Write "Thank you for submitting your information."
>
>  %>
>
> <p>
> <b><a href="index.html">Return</a></b>
>
> </body>
> </html>
>
>
>

Message #3 by "Ostrander, Lewis" <OstranderL@M...> on Wed, 14 Aug 2002 13:03:05 -0400
a
Message #4 by "Ostrander, Lewis" <OstranderL@M...> on Wed, 14 Aug 2002 13:09:49 -0400
Everytime you do a line jump you need to type in Dim.

Example:

dim fname, lname, nname, gender, address1, address2, city, state, zip, dim
subdiv, birthday, grade, class, instype, slot, moname, faname,phone, dim
email, mophone1, faphone1, mophone2, faphone2, notify, notifymethod, dim
liveparent, comments, serialno, insbrand, lessons,instructor, insurance, dim
data_source, con, sql_insert


It also looks like your doing a cdonts?  Why are you declaring your input
type names here.  You don't have to.

Dim body

body = body & "<font face=verdana size=2><b>" & " " & Request.Form("fname")&
" " & Request.Form("lname") & " " & "</b></font>"

**all on one line**

-----Original Message-----
From: Daniel Groh [mailto:daniel.groh@s...] 
Sent: Wednesday, August 14, 2002 1:00 PM
To: Access ASP
Subject: [access_asp] Re: Help!

for each line it need of a Dim

dim fname, lname, nname, gender, address1, address2, city, state, zip,
dim subdiv, birthday, grade, class, instype, slot, moname, faname, phone,
dim email, mophone1, faphone1, mophone2, faphone2, notify, notifymethod,
dim liveparent, comments, serialno, insbrand, lessons, instructor,
insurance,
dim data_source, con, sql_insert

Hugs

Daniel, Brazilian guy

----- Original Message -----
From: Staci Parrish <sparrish@w...>
To: Access ASP <access_asp@p...>
Sent: Wednesday, August 14, 2002 1:55 PM
Subject: [access_asp] Help!


> I'm getting the following error:
> Error Type:
> Microsoft VBScript compilation (0x800A03F2)
> Expected identifier
> /working/form_ac.asp, line 12, column 10
> dim fname,
> ---------^
>
> I hope someone can help!
>
> Here is the code for the page in question:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
> <html>
> <head>
> <LINK title=master href="style.css" type=text/css rel=stylesheet>
>
> </head>
>
> <body>
> <%
>    ' Declaring variables
>    dim fname, lname, nname, gender, address1, address2, city, state, zip,
> subdiv, birthday, grade, class, instype, slot, moname, faname, phone,
> email, mophone1, faphone1, mophone2, faphone2, notify, notifymethod,
> liveparent, comments, serialno, insbrand, lessons, instructor, insurance,
> data_source, con, sql_insert
>
>    ' A Function to check if some field entered by user is empty
>    Function ChkString(string)
>    If string = "" Then string = " "
>    ChkString = Replace(string, "'", "''")
>    End Function
>
>    ' Receiving values from Form
>   fname = ChkString(Request.Form("fname"))
> lname = ChkString(Request.Form("lname"))
> nname = ChkString(Request.Form("nname"))
> gender = ChkString(Request.Form("gender"))
> address1 = ChkString(Request.Form("address1"))
> address2 = ChkString(Request.Form("address2"))
> city = ChkString(Request.Form("city"))
> state = ChkString(Request.Form("state"))
> zip = ChkString(Request.Form("zip"))
> subdiv= ChkString(Request.Form("subdiv"))
> birthday= ChkString(Request.Form("birthday"))
> grade = ChkString(Request.Form("grade"))
> class = ChkString(Request.Form("class"))
> instype = ChkString(Request.Form("instype"))
> slot = ChkString(Request.Form("slot"))
> moname = ChkString(Request.Form("moname"))
> faname = ChkString(Request.Form("faname"))
> phone = ChkString(Request.Form("phone"))
> email= ChkString(Request.Form("email"))
> mophone1 = ChkString(Request.Form("mophone1"))
> faphone1 = ChkString(Request.Form("faphone1"))
> mophone2 = ChkString(Request.Form("mophone2"))
> faphone2 = ChkString(Request.Form("faphone2"))
> notify = ChkString(Request.Form("notify"))
> notifymethod = ChkString(Request.Form("notifymethod"))
> liveparent= ChkString(Request.Form("liveparent"))
> comments = ChkString(Request.Form("comments"))
> serialno = ChkString(Request.Form("serialno"))
> insbrand = ChkString(Request.Form("insbrand"))
> lessons = ChkString(Request.Form("lessons"))
> instructor = ChkString(Request.Form("instructor"))
> insurance = ChkString(Request.Form("insurance"))
> data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
>             Server.MapPath("form.mdb")
>
> sql_insert = "insert into users (fname, lname, nname, gender, address1,
> address2, city, state, zip, subdiv, birthday, grade, class, instype, slot,
> moname, faname, phone, email, mophone1, faphone1, mophone2, faphone2,
> notify, notifymethod, liveparent, comments, serialno, insbrand, lessons,
> instructor, insurance)
> values
> ('" & _ fname & "',
> '" & _ lname & "',
> '" & _ nname & "',
> '" & _ gender & "',
> '" & _ address1 & "',
> '" & _ address2 & "',
> '" & _ city & "',
> '" & _ state & "',
> '" & _ zip & "',
> '" & _ subdiv & "',
> '" & _ birthday & "',
> '" & _ grade & "',
> '" & _ class & "',
> '" & _ instype & "',
> '" & _ slot & "',
> '" & _ moname & "',
> '" & _ faname & "',
> '" & _ phone & "',
> '" & _ email & "',
> '" & _ mophone1 & "',
> '" & _ faphone1 & "',
> '" & _ mophone2 & "',
> '" & _ faphone2 & "',
> '" & _ notify & "',
> '" & _ notifymethod & "' ,
> '" & _ liveparent & "',
> '" & _ comments & "',
> '" & _ serialno & "',
> '" & _ insbrand & "',
> '" & _ lessons & "',
> '" & _ instructor & "',
> '" & _ insurance & "',)"
>
>    ' Creating Connection Object and opening the database
>    Set con = Server.CreateObject("ADODB.Connection")
>    con.Open data_source
>    con.Execute sql_insert
>    ' Done. Close the connection
>    con.Close
>    Set con = Nothing
>    Response.Write "Thank you for submitting your information."
>
>  %>
>
> <p>
> <b><a href="index.html">Return</a></b>
>
> </body>
> </html>
>
>
>


Message #5 by "SP" <sparrish@w...> on Wed, 14 Aug 2002 19:12:32
First, thanks for the quick responses...

I tried your suggestions...neither worked.  What am I doing wrong?  


Message #6 by "SP" <sparrish@w...> on Wed, 14 Aug 2002 19:48:06
Update!  I started with a clean asp page.  I inserted each item one by one 
to see the problem.  Well, call me stupid!  I was using "class" as a field 
name.  Big no, no, I know.  Just slipped my mind!  I changed the name of 
it and everything is peachy!  

Thanks again for your help.  



  Return to Index