can't retrieve a text data type in an ASP page through ADO 
Author Message
 can't retrieve a text data type in an ASP page through ADO

Greetings All!

I'm having a problem trying to retrieve a text field and display it on an
ASP page.

I am trying to connect to a Sybase db (ASE 11.9.2.5) and retrieve (and
display) several fields. All fields display EXCEPT the text field?

My connection code looks like:

set rs_details = Server.CreateObject("ADODB.Recordset")
rs_details.ActiveConnection = MM_web_db_STRING
rs_details.Source = "select col1, col2, ....col10 from MyTable where pk_id =
" + Cstr(key_id)
rs_details.CursorType = 0
rs_details.CursorLocation = 2
rs_details.LockType = 3
rs_details.Properties("Preserve On Commit") = True
rs_details.Properties("Preserve On Abort") = True
rs_details.Open()

When I get to where I want to display the text field (for example, column
10, I use:

<%IF NOT rs_details.EOF then
        IF rs_details(9).Value <> "" THEN%>
            <textarea wrap=YES rows="1" cols="70" id=textarea1
name=txtReason><%=rs_details(9).Value %></textarea>
etc....

I know something is in the column since:
    a) I populated it myself and,
    b) if I put some text after the statement   IF rs_details(9).Value <> ""
THEN, (e.g. Response.Write("we are inside rs_details(9)!") ) it is displayed
on the page!?

Is there a property of ADO specifically for text data types? Or is this a
problem with ASP?

Many thanks to all that respond!

cheers,

Norm



Fri, 08 Jul 2005 13:20:11 GMT  
 can't retrieve a text data type in an ASP page through ADO
Have you tried simply displaying it without the IF rs_details(9).Value <> ""
statement (in general, I prefer testing the length of a string rather than
comparing it to an empty string)?

I don't know what verison of ADO you're using, but there used to be an issue
retrieving the contents of a text column if it wasn't the last column listed
in your select statement. I'm not sure if they've fixed this or not, but you
could try moving the column to the end of your column list if it's not
already there.

You may have a situation where you need to use GetChunk to read the contents
of the field. Check it  out in MSDN's ADO API Reference.

HTH,
Bob Barrows


Quote:
> Greetings All!

> I'm having a problem trying to retrieve a text field and display it on an
> ASP page.

> I am trying to connect to a Sybase db (ASE 11.9.2.5) and retrieve (and
> display) several fields. All fields display EXCEPT the text field?

> rs_details.Source = "select col1, col2, ....col10 from MyTable where pk_id
> =
> " + Cstr(key_id)
> rs_details.Open()

> When I get to where I want to display the text field (for example, column
> 10, I use:

> <%IF NOT rs_details.EOF then
>         IF rs_details(9).Value <> "" THEN%>
>             <textarea wrap=YES rows="1" cols="70" id=textarea1
> name=txtReason><%=rs_details(9).Value %></textarea>
> etc....

> I know something is in the column since:
>     a) I populated it myself and,
>     b) if I put some text after the statement   IF rs_details(9).Value <>
> ""
> THEN, (e.g. Response.Write("we are inside rs_details(9)!") ) it is
> displayed
> on the page!?

> Is there a property of ADO specifically for text data types? Or is this a
> problem with ASP?

> Many thanks to all that respond!

> cheers,

> Norm



Sat, 09 Jul 2005 08:20:51 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Retrieving a Value

2. units in TP 3.0...

3. retrieve binary data from SQL server onto ASP page

4. FILE UPLOAD FROM ASP TO SQL SERVER TEXT DATA TYPE

5. Turbo Pascal like Visual Basic ???

6. SQL Query and the '\' character

7. Displaying results on a graph

8. Display Filed Description, Filed Data Type on ASP Page

9. Display Filed Description, Filed Data Type on ASP Page

10. reading field of type text into an ASP page - half newbie

11. 'Canned' data in VB program

12. ASP page won't display text from MS Access Memo field

 

 
Powered by phpBB® Forum Software