473,394 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 8740
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

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

Similar topics

13
by: | last post by:
I have an Access database used to track donor pledges. In it, there is a table that contains three fields for each donor: Gift_Amount, Gift_Per_Year, and Matching_Gift_Ratio. The following...
0
by: Channing Jones | last post by:
Hello everyone, I am trying to store data in a binary field of an SQL-Server table using ADODB. So far, I have managed to store a record but not any data in the binary field. I only get...
2
by: Jan Hendrickx | last post by:
Hi all, I use (something like) following code to add new records to a database, but it doesn't work!!! I need to know the value of an AutoNumber-field when I add the record. Why doesn't it...
4
by: Phillip J. Allen | last post by:
Hi all, I have a table with an “autonumber” primary key field that also acts as a foreign key in 2 other tables. I would like to programmatically add a new record to the first table and the...
5
by: Simone | last post by:
Hello I hope you guys can help me. I am very new to ADO... I am creating a ADODB connection in a module and trying to access it from a command button in a form. Function fxEIDAssgn(plngEID As...
1
by: mike11d11 | last post by:
Can anyone Tell me why this code doesnt let me bind a Textbox field to the Account# column in my SQL table. It says "Cannot bind to the property or column ACCOUNT# on the DataSource. Parameter...
1
by: deepaks85 | last post by:
Dear Friends, I have create a form in which user can update his/her records. The data can retrieved from the code which i have put in dropdown menu. Now I want to display all the records as per...
1
by: teenagelcruise | last post by:
hi, i have a problem with my code which is i cannot update and addnew data into the database but i can delete the data.plz give me an idea.this is my code that i wrote. <html> <head> <meta...
2
by: cephal0n | last post by:
I have this peroblem thats really bugging me for days, please have a patience to read it and help me find the probplem because I knew I missed it and just cant tell where. I have a table named...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.