469,331 Members | 1,749 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,331 developers. It's quick & easy.

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 8395
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
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
1 post views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.