p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

access thread: complete text not added to database


Message #1 by "Melissa Messersmith" <mesz_78@y...> on Tue, 5 Jun 2001 20:54:42
i have an ASP form that adds information to an access database.  however, 

if a person enters a space (" ")inside the text box, the rest of the 

information typed into the text box is cut off and not entered into the 

database. what am i doing wrong?
Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Tue, 05 Jun 2001 13:46:21 -0700
Hmm... I've seen this problem with embedded quotes, but not spaces.  The

problem with quotes is that ADO thinks the embedded quotes are terminating

the string to be inserted into the database field, and ignores the rest.



I don't suppose that's an explanation for the behavior you're seeing, is it?



Cheers,



-Roy



-----Original Message-----

From: Melissa Messersmith [mailto:mesz_78@y...]

Sent: Tuesday, June 05, 2001 1:54 PM

To: Access

Subject: [access] complete text not added to database





i have an ASP form that adds information to an access database.  however, 

if a person enters a space (" ")inside the text box, the rest of the 

information typed into the text box is cut off and not entered into the 

database. what am i doing wrong?




Message #3 by Melissa Messersmith <mesz_78@y...> on Wed, 6 Jun 2001 06:26:39 -0700 (PDT)
Well, the thing is, I think it is terminating the

string,(in a weird way...) except I'm not getting an error

message.  Let me explain the set up:

I have and HTML form with text boxes that captures the

users information.

I have two ASP pages.  The first pages spits all the

information back out and says...is this what u want to

submit? (The ASP checks to make sure none of the fields are

blank.)

The second ASP page adds the records to the database.  



So let's say I'm a user and in the "interests" field i type

in tennis, swimming, and golf.  

The only information that appears in Access is "tennis".

All of the fields are being sent to the database, just not

all of the information.



--- "Pardee, Roy E" <roy.e.pardee@l...> wrote:

> Hmm... I've seen this problem with embedded quotes, but

> not spaces.  The

> problem with quotes is that ADO thinks the embedded

> quotes are terminating

> the string to be inserted into the database field, and

> ignores the rest.

> 

> I don't suppose that's an explanation for the behavior

> you're seeing, is it?

> 

> Cheers,

> 

> -Roy

> 

> -----Original Message-----

> From: Melissa Messersmith [mailto:mesz_78@y...]

> Sent: Tuesday, June 05, 2001 1:54 PM

> To: Access

> Subject: [access] complete text not added to database

> 

> 

> i have an ASP form that adds information to an access

> database.  however, 

> if a person enters a space (" ")inside the text box, the

> rest of the 

> information typed into the text box is cut off and not

> entered into the 

> database. what am i doing wrong?

> 
Message #4 by "Pardee, Roy E" <roy.e.pardee@l...> on Wed, 06 Jun 2001 07:50:58 -0700
Ach, that's tough--can we see the relevant bits of code?

Message #5 by Melissa Messersmith <mesz_78@y...> on Wed, 6 Jun 2001 08:33:49 -0700 (PDT)
Sorry!  i didn't know attachments were a no-no.  it's kinda

long so i only used the first couple of fields.  here it

is......







PROFILE.asp





<FORM ACTION="profilesubmit.asp" METHOD="post">



<%

'declare database connection variables

Dim MyConnectCommand

Dim MyConnection

'declare database recordset variable

Dim dbrecordSet



'set database connection variables

Set MyConnection = Server.CreateObject("ADODB.Connection")

MyConnectCommand = "Driver={Microsoft Access Driver

(*.mdb)};DBQ=" & Server.MapPath("/_private/profile.mdb")

MyConnection.Open "DSN=profile"



'set the recordset connection variable

Set dbrecordset = Server.CreateObject("ADODB.Recordset")

dbrecordset.Open "profile", MyConnection, adOpenDynamic,

adLockOptimistic, adCmdTable



'validate the input data

response.write "<CENTER><B><FONT COLOR=#285a29 SIZE=+1

FACE=verdana,helvetica,arial>Please make sure all the data

you are about to submit is correct."



response.write "<BR><B><FONT COLOR=#285a29 SIZE=+1

FACE=verdana,helvetica,arial>Click the Back button on your

browser to change your information.</FONT></CENTER><BR>"



if request.form("FirstName") = "" then

	response.write "<B><FONT COLOR=#285a29 SIZE=+1

FACE=verdana,helvetica,arial>" & "You did not enter a First

Name!" & "<BR>"

else

	response.write "<B><FONT COLOR=#285a29

FACE=verdana,helvetica,arial>First Name " & " = " &

request.form("FirstName") & "<BR>"

end if

if request.form("LastName") = "" then

	response.write "<B><FONT COLOR=#285a29 SIZE=+1

FACE=verdana,helvetica,arial>" & "You did not enter a Last

Name!" & "<BR>"

else

	response.write "<B><FONT COLOR=#285a29

FACE=verdana,helvetica,arial>Last Name " & " = " &

request.form("LastName") & "<BR>"

end if

response.write "<B><FONT COLOR=#285a29

FACE=verdana,helvetica,arial>Birth Name " & " = " &

request.form("BirthName") & "<BR>"

if request.form("StreetAddress") = "" then

	response.write "<B><FONT COLOR=#285a29 SIZE=+1

FACE=verdana,helvetica,arial>" & "You did not enter a

Street Address!" & "<BR>"

else

	response.write "<B><FONT COLOR=#285a29

FACE=verdana,helvetica,arial>Street Address " & " = " &

request.form("StreetAddress") & "<BR>"

end if



ETC............



%>

<input type=hidden name="FirstName" value=<%

=request.form("FirstName")%>>

<input type=hidden name="LastName" value=<%

=request.form("LastName")%>>

<input type=hidden name="BirthName" value=<%

=request.form("BirthName")%>>

<input type=hidden name="StreetAddress" value=<%

=request.form("StreetAddress")%>>

<input type=hidden name="City" value=<%

=request.form("City")%>>

<input type=hidden name="State" value=<%

=request.form("State")%>>

<input type=hidden name="Zip" value=<%

=request.form("Zip")%>>

<input type=hidden name="Telephone"

value=<%=request.form("Telephone")%>>

<input type=hidden name="Email" value=<%

=request.form("Email")%>>

<input type=hidden name="Degree" value=<%

=request.form("Degree")%>>

<input type=hidden name="Year" value=<%

=request.form("Year")%>>

<input type=hidden name="Major" value=<%

=request.form("Major")%>>

<input type=hidden name="HighestDegree" value=<%

=request.form("HighestDegree")%>>

<input type=hidden name="Where" value=<%

=request.form("Where")%>>

<input type=hidden name="Orgs" value=<%

=request.form("Orgs")%>>

<input type=hidden name="Activities" value=<%

=request.form("Activities")%>>

<input type=hidden name="Job" value=<%

=request.form("Job")%>>

<input type=hidden name="CompName" value=<%

=request.form("CompName")%>>

<input type=hidden name="Location" value=<%

=request.form("Location")%>>



ETC...



<INPUT TYPE="submit" VALUE="Submit to Database"

ACTION="profilesubmit.asp" METHOD="post">











PROFILESUBMIT.asp





<form action=profilesubmit.asp method=post>



<%

'declare database connection variables

Dim MyConnectCommand

Dim MyConnection



'declare database recordset variable

Dim dbrecordset



'set database connection variables

Set MyConnection = Server.CreateObject("ADODB.Connection")

MyConnectCommand = "Driver={Microsoft Access Driver

(*.mdb)};DBQ=" & Server.MapPath("/_private/profile.mdb")

MyConnection.Open "DSN=profile"



'set the recordset connection variable

Set dbrecordset = Server.CreateObject("ADODB.Recordset")

dbrecordset.Open "profile", MyConnection, adOpenDynamic,

adLockOptimistic, adCmdTable



'add the new record

dbrecordset.AddNew



'profile information

dbrecordset("FIRSTNAME") = request.form("FirstName")

dbrecordset("LASTNAME") = request.form("LastName")

dbrecordset("BIRTHNAME") = request.form("BirthName")

dbrecordset("STREETADDRESS") 

request.form("StreetAddress")

dbrecordset("CITY") = request.form("City")

dbrecordset("STATE") = request.form("State")

dbrecordset("ZIP") = request.form("Zip")

dbrecordset("TELEPHONE") = request.form("Telephone")

dbrecordset("EMAIL") = request.form("Email")

dbrecordset("DEGREE") = request.form("Degree")

dbrecordset("YEAR") = request.form("Year")

dbrecordset("MAJOR") = request.form("Major")

dbrecordset("HIGHESTDEGREE") 

request.form("HighestDegree")

ETC....





'final the update then close the recordset

dbrecordset.Update

dbrecordset.Close

%>



<BR>





Message #6 by "Pardee, Roy E" <roy.e.pardee@l...> on Wed, 06 Jun 2001 09:17:02 -0700
Hmm... That looks pretty straightforward to me (and my ASP-guy collegue).  I

would try to trace the exact point at which the string is getting truncated.

Is the whole comma-delimited list getting encoded into the request URL, for

instance, or is it getting chopped off prior to the user clicking the Submit

button or...?



Sorry not to be more help...



Cheers,



-Roy



-----Original Message-----

From: Melissa Messersmith [mailto:mesz_78@y...]

Sent: Wednesday, June 06, 2001 8:34 AM

To: Access

Subject: [access] RE: complete text not added to database





Sorry!  i didn't know attachments were a no-no.  it's kinda

long so i only used the first couple of fields.  here it

is......







PROFILE.asp





<FORM ACTION="profilesubmit.asp" METHOD="post">



<%

'declare database connection variables

Dim MyConnectCommand

Dim MyConnection

'declare database recordset variable

Dim dbrecordSet



'set database connection variables

Set MyConnection = Server.CreateObject("ADODB.Connection")

MyConnectCommand = "Driver={Microsoft Access Driver

(*.mdb)};DBQ=" & Server.MapPath("/_private/profile.mdb")

MyConnection.Open "DSN=profile"



'set the recordset connection variable

Set dbrecordset = Server.CreateObject("ADODB.Recordset")

dbrecordset.Open "profile", MyConnection, adOpenDynamic,

adLockOptimistic, adCmdTable



'validate the input data

response.write "<CENTER><B><FONT COLOR=#285a29 SIZE=+1

FACE=verdana,helvetica,arial>Please make sure all the data

you are about to submit is correct."



response.write "<BR><B><FONT COLOR=#285a29 SIZE=+1

FACE=verdana,helvetica,arial>Click the Back button on your

browser to change your information.</FONT></CENTER><BR>"



if request.form("FirstName") = "" then

	response.write "<B><FONT COLOR=#285a29 SIZE=+1

FACE=verdana,helvetica,arial>" & "You did not enter a First

Name!" & "<BR>"

else

	response.write "<B><FONT COLOR=#285a29

FACE=verdana,helvetica,arial>First Name " & " = " &

request.form("FirstName") & "<BR>"

end if

if request.form("LastName") = "" then

	response.write "<B><FONT COLOR=#285a29 SIZE=+1

FACE=verdana,helvetica,arial>" & "You did not enter a Last

Name!" & "<BR>"

else

	response.write "<B><FONT COLOR=#285a29

FACE=verdana,helvetica,arial>Last Name " & " = " &

request.form("LastName") & "<BR>"

end if

response.write "<B><FONT COLOR=#285a29

FACE=verdana,helvetica,arial>Birth Name " & " = " &

request.form("BirthName") & "<BR>"

if request.form("StreetAddress") = "" then

	response.write "<B><FONT COLOR=#285a29 SIZE=+1

FACE=verdana,helvetica,arial>" & "You did not enter a

Street Address!" & "<BR>"

else

	response.write "<B><FONT COLOR=#285a29

FACE=verdana,helvetica,arial>Street Address " & " = " &

request.form("StreetAddress") & "<BR>"

end if



ETC............



%>

<input type=hidden name="FirstName" value=<%

=request.form("FirstName")%>>

<input type=hidden name="LastName" value=<%

=request.form("LastName")%>>

<input type=hidden name="BirthName" value=<%

=request.form("BirthName")%>>

<input type=hidden name="StreetAddress" value=<%

=request.form("StreetAddress")%>>

<input type=hidden name="City" value=<%

=request.form("City")%>>

<input type=hidden name="State" value=<%

=request.form("State")%>>

<input type=hidden name="Zip" value=<%

=request.form("Zip")%>>

<input type=hidden name="Telephone"

value=<%=request.form("Telephone")%>>

<input type=hidden name="Email" value=<%

=request.form("Email")%>>

<input type=hidden name="Degree" value=<%

=request.form("Degree")%>>

<input type=hidden name="Year" value=<%

=request.form("Year")%>>

<input type=hidden name="Major" value=<%

=request.form("Major")%>>

<input type=hidden name="HighestDegree" value=<%

=request.form("HighestDegree")%>>

<input type=hidden name="Where" value=<%

=request.form("Where")%>>

<input type=hidden name="Orgs" value=<%

=request.form("Orgs")%>>

<input type=hidden name="Activities" value=<%

=request.form("Activities")%>>

<input type=hidden name="Job" value=<%

=request.form("Job")%>>

<input type=hidden name="CompName" value=<%

=request.form("CompName")%>>

<input type=hidden name="Location" value=<%

=request.form("Location")%>>



ETC...



<INPUT TYPE="submit" VALUE="Submit to Database"

ACTION="profilesubmit.asp" METHOD="post">











PROFILESUBMIT.asp





<form action=profilesubmit.asp method=post>



<%

'declare database connection variables

Dim MyConnectCommand

Dim MyConnection



'declare database recordset variable

Dim dbrecordset



'set database connection variables

Set MyConnection = Server.CreateObject("ADODB.Connection")

MyConnectCommand = "Driver={Microsoft Access Driver

(*.mdb)};DBQ=" & Server.MapPath("/_private/profile.mdb")

MyConnection.Open "DSN=profile"



'set the recordset connection variable

Set dbrecordset = Server.CreateObject("ADODB.Recordset")

dbrecordset.Open "profile", MyConnection, adOpenDynamic,

adLockOptimistic, adCmdTable



'add the new record

dbrecordset.AddNew



'profile information

dbrecordset("FIRSTNAME") = request.form("FirstName")

dbrecordset("LASTNAME") = request.form("LastName")

dbrecordset("BIRTHNAME") = request.form("BirthName")

dbrecordset("STREETADDRESS") 

request.form("StreetAddress")

dbrecordset("CITY") = request.form("City")

dbrecordset("STATE") = request.form("State")

dbrecordset("ZIP") = request.form("Zip")

dbrecordset("TELEPHONE") = request.form("Telephone")

dbrecordset("EMAIL") = request.form("Email")

dbrecordset("DEGREE") = request.form("Degree")

dbrecordset("YEAR") = request.form("Year")

dbrecordset("MAJOR") = request.form("Major")

dbrecordset("HIGHESTDEGREE") 

request.form("HighestDegree")

ETC....





'final the update then close the recordset

dbrecordset.Update

dbrecordset.Close

%>



<BR>










Message #7 by hraud@n... on Thu, 7 Jun 2001 14:49:57
I have run into this exact same problem before.  You are missing the 

double-quotes for the value parameter in the input field definitions on 

your form.  For example, instead of:



<input type=hidden name="FirstName" value=<%=request.form("FirstName")%>>



use:



<input type=hidden name="FirstName" value="<%=request.form("FirstName")%>">



Regards,

Henry





> i have an ASP form that adds information to an access database.  

however, 

> if a person enters a space (" ")inside the text box, the rest of the 

> information typed into the text box is cut off and not entered into the 


  Return to Index