Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Error! Having images in a form with the post!


Message #1 by "Masoud Samimi" <samimi73@y...> on Sun, 26 Aug 2001 07:07:29
Hi,



The scenario is like this:



In one ASP (1st), I have a form to post to another ASP (2nd) for process 

and insert values. The problem is that on the 1st ASP, I have images on 

the form that are not any part of the database, they are just there for 

visual interface to the user, somthing like an image of a file, book, etc.



A small fragment of my code:



.............



<!--  Form to post the registerations -->

<form method="post" action="register.asp" id="frmsingup" name="frmsignup">



<!--  Table to display the form entry fields -->

<table width="800" height="450" cellspacing="0" cellpadding="0">

<!--  First Name -->



<tr>

	<td align="left">First Name:</td>

	<td><input type="text" value="<%=session("chrFirstName")%>" 

name="chrFirstName" size="50"></td>

	<td align="right"><img src="images/afname.gif"></td>

</tr>

<!--  Last Name -->

<tr>

	<td align="left">Last Name:</td>

	<td><input type="text" value="<%=session("chrLastName")%>" 

name="chrLastName" size="50"></td>

	<td align="right"><img src="images/alname.gif"></td>

</tr>



</table>	

</form>



<table>

<!--  Submit Button -->



<tr>

<td>

[ <a href="default.asp"><img src="images/ahome.gif" width="211" 

height="22" border="0" alt="Return Home!"></a> ]

</td>

</tr>



</table>



.............



Please note that I am not posting images to the database, they are just 

visual on the form.



When I submit the form, it ends up with the error message:



Microsoft OLE DB Provider for ODBC Drivers error '80040e57' 



[Microsoft][ODBC SQL Server Driver][SQL Server]String or binary data would 

be truncated. 



/twcb/register.asp, line 198 





Cheers

Masoud

Message #2 by Greg Griffiths <griffiths@x...> on Sun, 26 Aug 2001 12:22:46 +0100
It sounds like there is an error in your ASP, post your ASP code, 

especially any lines that contain SQL.



At 07:07 26/08/01 +0000, you wrote:

>Hi,

>

>The scenario is like this:

>

>In one ASP (1st), I have a form to post to another ASP (2nd) for process

>and insert values. The problem is that on the 1st ASP, I have images on

>the form that are not any part of the database, they are just there for

>visual interface to the user, somthing like an image of a file, book, etc.

>

>A small fragment of my code:

>

>.............

>

><!--  Form to post the registerations -->

><form method="post" action="register.asp" id="frmsingup" name="frmsignup">

>

><!--  Table to display the form entry fields -->

><table width="800" height="450" cellspacing="0" cellpadding="0">

><!--  First Name -->

>

><tr>

>         <td align="left">First Name:</td>

>         <td><input type="text" value="<%=session("chrFirstName")%>"

>name="chrFirstName" size="50"></td>

>         <td align="right"><img src="images/afname.gif"></td>

></tr>

><!--  Last Name -->

><tr>

>         <td align="left">Last Name:</td>

>         <td><input type="text" value="<%=session("chrLastName")%>"

>name="chrLastName" size="50"></td>

>         <td align="right"><img src="images/alname.gif"></td>

></tr>

>

></table>

></form>

>

><table>

><!--  Submit Button -->

>

><tr>

><td>

>[ <a href="default.asp"><img src="images/ahome.gif" width="211"

>height="22" border="0" alt="Return Home!"></a> ]

></td>

></tr>

>

></table>

>

>.............

>

>Please note that I am not posting images to the database, they are just

>visual on the form.

>

>When I submit the form, it ends up with the error message:

>

>Microsoft OLE DB Provider for ODBC Drivers error '80040e57'

>

>[Microsoft][ODBC SQL Server Driver][SQL Server]String or binary data would

>be truncated.

>

>/twcb/register.asp, line 198

>

>

>Cheers

>Masoud

>

>

Message #3 by "Masoud Samimi" <samimi73@y...> on Sun, 26 Aug 2001 15:20:46
Hi Greg,



Thank you for your reply and concern. 



Please find the full ASP pasted below and forgive me that it is lengthy, 

but the details matter as I am sure something is wrong there and I can't 

find it! :(



....................................



<%@ Language=VBScript %>





<html>

<body bgcolor="orange">



<!--#include file="include/headerF.asp"-->



<center>





<!--  Display the sign up form.  -->

<img src="images/formtxtf.gif"><br><br>



<!--  Form to post the registerations -->

<form method="post" action="register.asp" id="frmsingup" name="frmsignup">



<!--  Table to display the profile data -->

<table width="800" height="450" cellspacing="0" cellpadding="0">

<!--  First Name -->



<tr>

	<td align="left">First Name:</td>

	<td><input type="text" value="<%=session("chrFirstName")%>" 

name="chrFirstName" size="50"></td>

	<td align="right"><img src="images/ffname.gif" width="19" 

height="24"></td>

</tr>

<!--  Shipping Last Name -->

<tr>

	<td align="left">Last Name:</td>

	<td><input type="text" value="<%=session("chrLastName")%>" 

name="chrLastName" size="50"></td>

	<td align="right"><img src="images/flname.gif"></td>

</tr>

<!--  Address -->

<tr>

	<td align="left">Address:</td>

	<td>

	<input type="text" value="<%=session("chrAddress")%>" 

name="chrAddress" size="50"></td>

	<td align="right"><img src="images/addf.gif"></td>

</tr>

<!--  City -->

<tr>

	<td align="left">City:</td>

	<td>

	<input type="text" value="<%=session("chrCity")%>" name="chrCity" 

size="50"></td>

	<td align="right"><img src="images/cityf.gif"></td>

</tr>



<tr>

	<td align="left">

	State: (US only)</td>

	

	<td>

	

	<% 



	'  Check to see which state was selected previously

	'  if there was an error.

	if session("chrState") = "AL" then 

		SelAL = "Selected"

	end if



	if session("chrState") = "AK" then 

		SelAK = "Selected"

	end if



	if session("chrState") = "AZ" then 

		SelAZ = "Selected"

	end if



	if session("chrState") = "AR" then 

		SelAR = "Selected"

	end if



	if session("chrState") = "CA" then 

		SelCA = "Selected"

	end if



	if session("chrState") = "CT" then 

		SelCT = "Selected"

	end if



	if session("chrState") = "CO" then 

		SelCO = "Selected"

	end if



	if session("chrState") = "DC" then 

		SelDC = "Selected"

	end if



	if session("chrState") = "DE" then 

		SelDE = "Selected"

	end if



	if session("chrState") = "FL" then 

		SelFL = "Selected"

	end if



	if session("chrState") = "GA" then 

		SelGA = "Selected"

	end if



	if session("chrState") = "HI" then 

		SelHI = "Selected"

	end if



	if session("chrState") = "ID" then 

		SelID = "Selected"

	end if



	if session("chrState") = "IL" then 

		SelIL = "Selected"

	end if



	if session("chrState") = "IN" then 

		SelIN = "Selected"

	end if



	if session("chrState") = "IA" then 

		SelIA = "Selected"

	end if



	if session("chrState") = "KS" then 

		SelKS = "Selected"

	end if



	if session("chrState") = "KY" then 

		SelKY = "Selected"

	end if



	if session("chrState") = "LA" then 

		SelLA = "Selected"

	end if



	if session("chrState") = "ME" then 

		SelME = "Selected"

	end if



	if session("chrState") = "MA" then 

		SelMA = "Selected"

	end if



	if session("chrState") = "MD" then 

		SelMD = "Selected"

	end if



	if session("chrState") = "MI" then 

		SelMI = "Selected"

	end if



	if session("chrState") = "MN" then 

		SelMN = "Selected"

	end if



	if session("chrState") = "MS" then 

		SelMS = "Selected"

	end if



	if session("chrState") = "MO" then 

		SelMO = "Selected"

	end if



	if session("chrState") = "MT" then 

		SelMT = "Selected"

	end if



	if session("chrState") = "NE" then 

		SelNE = "Selected"

	end if



	if session("chrState") = "NV" then 

		SelNV = "Selected"

	end if



	if session("chrState") = "NH" then 

		SelNH = "Selected"

	end if



	if session("chrState") = "NJ" then 

		SelNJ = "Selected"

	end if



	if session("chrState") = "NM" then 

		SelNM = "Selected"

	end if



	if session("chrState") = "NY" then 

		SelNY = "Selected"

	end if



	if session("chrState") = "NC" then 

		SelNC = "Selected"

	end if



	if session("chrState") = "ND" then 

		SelND = "Selected"

	end if



	if session("chrState") = "OH" then 

		SelOH = "Selected"

	end if



	if session("chrState") = "OK" then 

		SelOK = "Selected"

	end if



	if session("chrState") = "OR" then 

		SelOR = "Selected"

	end if



	if session("chrState") = "PA" then 

		SelPA = "Selected"

	end if



	if session("chrState") = "RI" then 

		SelRI = "Selected"

	end if



	if session("chrState") = "SC" then 

		SelSC = "Selected"

	end if



	if session("chrState") = "SD" then 

		SelSD = "Selected"

	end if



	if session("chrState") = "TN" then 

		SelTN = "Selected"

	end if



	if session("chrState") = "TX" then 

		SelTX = "Selected"

	end if



	if session("chrState") = "UT" then 

		SelUT = "Selected"

	end if



	if session("chrState") = "VT" then 

		SelVT = "Selected"

	end if



	if session("chrState") = "VA" then 

		SelVA = "Selected"

	end if



	if session("chrState") = "WY" then 

		SelWY = "Selected"

	end if



	if session("chrState") = "WI" then 

		SelWI = "Selected"

	end if



	if session("chrState") = "WV" then 

		SelWV = "Selected"

	end if



	if session("chrState") = "WA" then 

		SelWA = "Selected"

	end if



	if session("chrState") = "FSO" then 

		SelFSO = "Selected"

	end if

	

	%>



	<!--  State select box.  -->

	<select name="chrState">

		<option value>Select a State

		<option value="AL" <%=SelAL%>>Alabama

		<option value="AK" <%=SelAK%>>Alaska

		<option value="AZ" <%=SelAZ%>>Arizona

		<option value="AR" <%=SelAR%>>Arkansas

		<option value="CA" <%=SelCA%>>California

		<option value="CT" <%=SelCT%>>Connecticut

		<option value="CO" <%=SelCO%>>Colorado

		<option value="DC" <%=SelDC%>>D.C.

		<option value="DE" <%=SelDE%>>Delaware

		<option value="FL" <%=SelFL%>>Florida

		<option value="GA" <%=SelGA%>>eorgia

		<option value="HI" <%=SelHI%>>Hawaii

		<option value="ID" <%=SelID%>>Idaho

		<option value="IL" <%=SelIL%>>Illinois

		<option value="IN" <%=SelIN%>>Indiana

		<option value="IA" <%=SelIA%>>Iowa

		<option value="KS" <%=SelKS%>>Kansas

		<option value="KY" <%=SelKY%>>Kentucky

		<option value="LA" <%=SelLA%>>Louisiana

		<option value="ME" <%=SelME%>>Maine

		<option value="MA" <%=SelMA%>>Massachusetts

		<option value="MD" <%=SelMD%>>Maryland

		<option value="MI" <%=SelMI%>>Michigan

		<option value="MN" <%=SelMN%>>Minnesota

		<option value="MS" <%=SelMS%>>Mississippi

		<option value="MO" <%=SelMO%>>Missouri

		<option value="MT" <%=SelMT%>>Montana

		<option value="NE" <%=SelNE%>>Nebraska

		<option value="NV" <%=SelNV%>>Nevada

		<option value="NH" <%=SelNH%>>New Hampshire

		<option value="NJ" <%=SelNJ%>>New Jersey

		<option value="NM" <%=SelNM%>>New Mexico

		<option value="NY" <%=SelNY%>>New York

		<option value="NC" <%=SelNC%>>North Carolina

		<option value="ND" <%=SelND%>>North Dakota

		<option value="OH" <%=SelOH%>>Ohio

		<option value="OK" <%=SelOK%>>Oklahoma

		<option value="OR" <%=SelOR%>>Oregon

		<option value="PA" <%=SelPA%>>Pennsylvania

		<option value="RI" <%=SelRI%>>Rhode Island

		<option value="SC" <%=SelSC%>>South Carolina

		<option value="SD" <%=SelSD%>>South Dakota

		<option value="TN" <%=SelTN%>>Tennessee

		<option value="TX" <%=SelTX%>>Texas

		<option value="UT" <%=SelUT%>>Utah

		<option value="VT" <%=SelVT%>>Vermont

		<option value="VA" <%=SelVA%>>Virginia

		<option value="WA" <%=SelWA%>>Washington

		<option value="WY" <%=SelWY%>>Wyoming

		<option value="WI" <%=SelWI%>>Wisconsin

		<option value="WV" <%=SelWV%>>West Virginia

		<option value="FSO" <%=SelFSO%>>Military Stuff

	</select>

	</td>

	

	<td align="right"><img src="images/statf.gif" width="108" 

height="24"></td>

</tr>



<!--  State -->

<tr>

	<td align="left">

	<!--  Province input -->

	Province:(Non US)</td>

	<td><input type="text" value="<%=session("chrProvince")%>" 

name="chrProvince" size="50"></td>

		

</tr>



<!--  Country -->

<tr>

	<td align="left">Country:</td>

	<td>

	

	<% 



	'  Check to see which country was selected previously

	'  if there was an error.

	if session("chrCountry") = "US" then 

		SelUS = "Selected"

	end if



	if session("chrCountry") = "UAE" then 

		SelUAE = "Selected"

	end if

	

	if session("chrCountry") = "CA" then 

		SelCA = "Selected"

	end if

	

	if session("chrCountry") = "MX" then 

		SelMX = "Selected"

	end if



	if session("chrCountry") = "IRAN" then 

		SelIRAN = "Selected"

	end if



	if session("chrCountry") = "IRAQ" then 

		SelIRAQ = "Selected"

	end if

		

	%>

	<!--  Country select box -->

	<select name="chrCountry">

		<option value>Select a Country

		<option value="US" <%=SelUS%>>United States

		<option value="UAE" <%=SelUAE%>>United Arab Emirates

		<option value="UK" <%=SelUK%>>United Kingdom

		<option value="CA" <%=SelCA%>>Canada

		<option value="MX" <%=SelMX%>>Mexico

		<option value="IRAN" <%=SelIRAN%>>Iran

		<option value="IRAQ" <%=SelIRAQ%>>Iraq

		

	</select>	



	</td>

	

	<td align="right"><img src="images/countf.gif"></td>

	

</tr>





<!--  Zip Code -->

<tr>

	<td align="left">Zip/Postal Code:</td>

	<td align="left">

	<input type="text" value="<%=session("chrZipCode")%>" 

name="chrZipCode">

	</td>

	<td align="right"><img src="images/pbf.gif"></td>

</tr>

<!--  Phone -->

<tr>

	<td align="left">Phone:[Country-Area-Number]</td>

	<td>

	<input type="text" value="<%=session("chrPhone")%>" 

name="chrPhone">

	</td><td align="right"><img src="images/tlf.gif"></td>

</tr>

<!--  Fax -->

<tr>

	<td align="left">Fax:[Country-Area-Number]</td>

	<td>

	<input type="text" value="<%=session("chrFax")%>" name="chrFax">

	</td><td align="right"><img src="images/fxf.gif"></td>

</tr>

<!--  Email -->

<tr>

	<td align="left">Email:</td>

	<td>

	<input type="text" value="<%=session("chrEmail")%>" 

name="chrEmail">

	</td><td align="right"><img src="images/emlf.gif"></td>

</tr>

<!--  Password -->

<tr>

	<td align="left">Password:</td>

	<td>

	<input type="password" value name="chrPassword" )>

	</td><td align="right"><img src="images/pswf.gif"></td>

</tr>



</table>



<table>

<!--  Submit Button -->

<tr>

	<td colspan="2" align="center">

		

		<input type="hidden" name="idRegistery" value="<%=session

("idRegistery")%>">

		       

		<input type="submit" value="Submit" name="Submit">

	</td>

</tr>



</table>	

</form>





<table>

<!--  Submit Button -->



<tr>

<td>

[ <a href="default.asp"><img src="images/fhome.gif" width="120" 

height="24" border="0" alt="Return Home!"></a> ]

</td>

</tr>



</table>	



<!--#include file="include/footerf.asp"-->



</body>

</html>



....................................



Please note that above is code of the posting ASP (1st) and that 

strangely, the same but *without* the *Images* is perfectly functional! 



The process ASP (2nd) is all the time the same code! The errors lay in 

this one I guess.



If you require the 2nd ASP code, please let me know.



Cheers

Masoud





> It sounds like there is an error in your ASP, post your ASP code, 

> especially any lines that contain SQL.

 

Message #4 by "Masoud Samimi" <samimi73@y...> on Sun, 26 Aug 2001 17:25:26
I found the error by having the *sql* statement written to the screen with 

Response.Write(sql).

The parameters to be passed to the SP which come posted from the 1st ASP, 

are:



chrFirstName, chrLastName, chrAddress, chrCity, chrState, chrProvince, 

chrCountry, chrZipCode, chrPhone, chrFax, chrEmail, chrPassword



And these two lines below are the Response.Write(sql) for both cases, 

wintout and then with the images:





execute 

sp_AddRegistrar 'm', 'm', 'm', 'm', '', 'm', 'UAE', '9', '9', '9', 'm@m...

m', 'mm'



execute sp_AddRegistrar 'a', 'a', 'a', 'a', 'Select a 

State', 'a', 'UAE', '4', '4', '4', 'aa@a...', 'a'





I noticed that in the 2nd line (with images), there is a 'Select a State' 

entry, while it should be '' as I have not

selected any States from the selection combo.



This is the error and as my code in the 2nd ASP checks, is not supposed to 

happen!?



What's wrong, I have no clue?! I guess I need you to look in the 2nd ASP. 

In case you don't mind, should I zip both 

and send attached to your email?



Thanks in advance,



Masoud
Message #5 by "Monique Angelich" <mangelich@m...> on Sun, 26 Aug 2001 18:10:06 -0400
Masoud,



I am not sure who you are asking for help, but if you would like to send the

files I will look at them for you also.



moe

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

From: "Masoud Samimi" <samimi73@y...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Sunday, August 26, 2001 5:25 PM

Subject: [asp_web_howto] Re: Error! Having images in a form with the- post!





> I found the error by having the *sql* statement written to the screen with

> Response.Write(sql).

> The parameters to be passed to the SP which come posted from the 1st ASP,

> are:

>

> chrFirstName, chrLastName, chrAddress, chrCity, chrState, chrProvince,

> chrCountry, chrZipCode, chrPhone, chrFax, chrEmail, chrPassword

>

> And these two lines below are the Response.Write(sql) for both cases,

> wintout and then with the images:

>

>

> execute

> sp_AddRegistrar 'm', 'm', 'm', 'm', '', 'm', 'UAE', '9', '9', '9',

'm@m...

> m', 'mm'

>

> execute sp_AddRegistrar 'a', 'a', 'a', 'a', 'Select a

> State', 'a', 'UAE', '4', '4', '4', 'aa@a...', 'a'

>

>

> I noticed that in the 2nd line (with images), there is a 'Select a State'

> entry, while it should be '' as I have not

> selected any States from the selection combo.

>

> This is the error and as my code in the 2nd ASP checks, is not supposed to

> happen!?

>

> What's wrong, I have no clue?! I guess I need you to look in the 2nd ASP.

> In case you don't mind, should I zip both

> and send attached to your email?

>

> Thanks in advance,

>

> Masoud

> 



Message #6 by "Hunuman" <hunuman@f...> on Sun, 26 Aug 2001 22:51:55 +0100
Masoud,



This error is raised by SQL Server to tell that the data you are putting in

a db column is too long.



Amend your form's input elements to use the same max length as the relavent

DB field.



Hope this helps



Tim M



+++++

If objToErr Is objHuman Then Set objForgive = New objDivine



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

Subject: [asp_web_howto] Error! Having images in a form with the post!





> Hi,

>

> The scenario is like this:

>

> In one ASP (1st), I have a form to post to another ASP (2nd) for process

> and insert values. The problem is that on the 1st ASP, I have images on

> the form that are not any part of the database, they are just there for

> visual interface to the user, somthing like an image of a file, book, etc.



<MSG SNIPPED>



> Please note that I am not posting images to the database, they are just

> visual on the form.

>

> When I submit the form, it ends up with the error message:

>

> Microsoft OLE DB Provider for ODBC Drivers error '80040e57'

>

> [Microsoft][ODBC SQL Server Driver][SQL Server]String or binary data would

> be truncated.

>

> /twcb/register.asp, line 198

>

>

> Cheers

> Masoud

>




  Return to Index