p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: Text display from SQL cut to 255 chars


Message #1 by "Wanda" <w.roberts@t...> on Thu, 20 Jul 2000 11:31:43
I have a recordset from which I am trying to display product descriptions 

which vary in length. The field data type is varchar(8000)in SQL Server 7, 

but ASP only retrieves and displays up to 255 characters although when it 

searches it searches the whole field.



I have tried (1)putting the field last in SQL statement, (2) assigning the 

field value to a variable then using the variable instead of field name , 

and (3) the VB 'GetChunk' method, but get "The operation requested by the 

application is not allowed in this context" error.



Getting really stuck now - any other suggestions?

Message #2 by "Dana Coffey" <ccsu5461@l...> on Thu, 20 Jul 2000 06:44:43 -0700
How are you displaying the information?  In a text box?  Using

"response.write" or calling the variable within the html such as

<%=variable%> ?



If you are putting it into a form element of any kind, check the size limits

of the form element.



Can you paste some code?



Dana Coffey

Technologist, Xceed, Inc.

112 Krog St.  Atlanta, GA  30307

tel.  xxx-xxx-xxxx  x 5013

www.xceed.com



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Everything should be as simple as it is, but not simpler.

----Albert Einstein

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~







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

From: Wanda 

Sent: Thursday, July 20, 2000 11:32 AM

To: ASP Databases

Subject: [asp_databases] Text display from SQL cut to 255 chars





I have a recordset from which I am trying to display product descriptions

which vary in length. The field data type is varchar(8000)in SQL Server 7,

but ASP only retrieves and displays up to 255 characters although when it

searches it searches the whole field.



I have tried (1)putting the field last in SQL statement, (2) assigning the

field value to a variable then using the variable instead of field name ,

and (3) the VB 'GetChunk' method, but get "The operation requested by the

application is not allowed in this context" error.



Getting really stuck now - any other suggestions?



Message #3 by "Wanda" <w.roberts@t...> on Thu, 20 Jul 2000 17:28:14
The results are displayed as variable within HTML but not restricted in 

form/table.  The problem is with the "programme_description" field.  We 

half sorted it by changing the SQL field data type to Text rather than 

varchar, but then it's impossible to query the SQL dbase doing a SELECT 

DISTINCT (because of mismatched field types). So now I can get all the 

result to display but end up with duplicate records.  It's clearly an 'ASP 

reading from SQL problem' which is not covered in any Microsoft support 

stuff. If you can help that would be great.



The code for displaying the RS results is:		 



<%While not objRS.EOF

strProgrammeId = objRS.Fields("programme_id"))

strProgrammeTitle = objRS.Fields("programme_title")%><BR>



<B><%=objRS("programme_code")%>: </B>

<%Response.write "<A HREF=" & "" & "prog_details.asp?prog_id=" & strProgrammeId & "" & ">" & strProgrammeTitle &
"</A>" & vbcrlf%><BR>



'*****problem field (with or without HTMLEncode)**************	

	

<%=Server.HTMLEncode(objRS("programme_description"))%><BR><BR>

Topic Area: <I><%=Server.HTMLEncode(objRS("programme_topic"))%>  </I><BR>

Date published: <%=objRS("programme_made")%><BR><HR>

 

<%objRS.MoveNext

   Wend
Message #4 by "Ken Schaefer" <ken.s@a...> on Fri, 21 Jul 2000 14:01:43 +1000
Retrieving large amounts of data from fields, eg text/memo fields, or even

large varChar fields is definately covered in the Microsoft KB - you need to

look harder! :-)



If you are using text/memo fields, you need to look at:

http://support.microsoft.com/support/kb/articles/Q200/1/24.ASP



Cheers

Ken



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

From: "Wanda" <>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, July 20, 2000 5:28 PM

Subject: [asp_databases] RE: Text display from SQL cut to 255 chars





> The results are displayed as variable within HTML but not restricted in

> form/table.  The problem is with the "programme_description" field.  We

> half sorted it by changing the SQL field data type to Text rather than

> varchar, but then it's impossible to query the SQL dbase doing a SELECT

> DISTINCT (because of mismatched field types). So now I can get all the

> result to display but end up with duplicate records.  It's clearly an 'ASP

> reading from SQL problem' which is not covered in any Microsoft support

> stuff. If you can help that would be great.

>

> The code for displaying the RS results is:

>

> <%While not objRS.EOF

> strProgrammeId = objRS.Fields("programme_id"))

> strProgrammeTitle = objRS.Fields("programme_title")%><BR>

>

> <B><%=objRS("programme_code")%>: </B>

> <%Response.write "<A HREF=" & "" & "prog_details.asp?prog_id=" &

strProgrammeId & "" & ">" & strProgrammeTitle & "</A>" & vbcrlf%><BR>

>

> '*****problem field (with or without HTMLEncode)**************

>

> <%=Server.HTMLEncode(objRS("programme_description"))%><BR><BR>

> Topic Area:

<I><%=Server.HTMLEncode(objRS("programme_topic"))%>  </I><BR>

> Date published: <%=objRS("programme_made")%><BR><HR>

>

> <%objRS.MoveNext

>    Wend






  Return to Index