472,145 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

Cannot get the field value from ADODB recordset

Hi,

I'm working on an ASP Jscript page run on IIS 5. However i got a very strange problem:

The code is like this

Expand|Select|Wrap|Line Numbers
  1. var rs = getPaymentDetail(pId);//Get the ADODB record set
  2. this.paymentId = pId;
  3. this.agreementId = String(rs("AgreementId"));
  4. this.supplierId = String(rs("SupplierId"));
  5. this.supplierName = String(rs("SupplierName"));
  6. Response.Write(rs.Fields(10).Value+"----");
The Response.Write write out: undefined------
But if i move this line up 1 or more line: before the rs("SupplierName"), it can write out the correct value.

I also try to write all the column in numeric order before doing anything to the recordset, this work perfectly fine, and list all the column with value correctly.
Expand|Select|Wrap|Line Numbers
  1. for (var i=0; i<rs.Fields.Count; i++)
  2.     Response.Write(i+" "+rs.Fields(i).Name+" "+rs.Fields(i).Value+"<br />");
I think it has something to do with the order we call the recordset field.

Anyone have any idea why this happen?

Thanks
Apr 16 '07 #1
4 8595
Btw, if I call this first,
Expand|Select|Wrap|Line Numbers
  1. for (var i=0; i<rs.Fields.Count; i++)
  2.     Response.Write(i+" "+rs.Fields(i).Name+" "+rs.Fields(i).Value+"<br />");
Then I can get all the fields of that recordset in any order correctly for the current row, if I do a moveNext, then the problem apear again.
Apr 16 '07 #2
I have found the source of the problem, it has something to do with the 'text' data type of Sybase, and not with ASP. Still I cannot find any document on that topic :(
Apr 17 '07 #3
I had the same issue with sql2005.

the field in my data base table that I was trying to print out using ASP is a nvarchar(MAX).

For solve the issue, that thing that I did was update the stored procedure that retrieve me the field value using something like this:

select
cast(table_column as varchar(3000)) as [name_of_column]
-- the column is delimited to just 3000 characters
from
table
where
blah blah blah

Seems to be an issue with ADODB and the length of char column types with lenght of MAX

I hope that this works for you...
Oct 22 '08 #4
Yeah if in your table u have a field of datatype Text then u cannot use the recordset in any order if u use like that then u wont be able to get the value
Oct 23 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Channing Jones | last post: by
2 posts views Thread by Jan Hendrickx | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.