Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: SQL data not being entered properly into an array


Message #1 by thekman@w... on Wed, 11 Sep 2002 00:27:16
Greetings all. I'm having a problem that has befuddled me and many 
programmers at my place of business. Hopefully one of you has seen this 
before and may be able to point me in the right direction.
I have an application that is pulling information from a table within an 
SQL database and is then dumping that information into an array in ASP. 
The information is sorted a few different ways and then is displayed to 
the user on a page inside an iFrame.
Some of the information is not being properly passed to the ASP array. 
Namely, there are two fields within the SQL database that are a 'text' 
data type that are not showing up properly. At first I was not receiving 
anything with an array after pulling one of those text strings - i.e. 
varchars were properly stored for array(0,1) and array(0,2), but after 
attempting to put one of the text data strings into array(0,3) none of the 
subsequent information would get entered, including let's say date type 
array(0,4). After modifying the SQL string, I was able to start receiving 
all the information, but the text data types would only return around the 
first 50 characters, and would then stop. I'm hesitant to think that this 
is an issue with my code, since simply changing the SQL string partially 
corrects the problem...but this application worked correctly before, and 
only began to have this issue after I upgraded some of the code. I've gone 
over this code again and again, and don't see any issues with it - 
particularly in any areas which may relate to the specified problem.
Let me show you the SQL strings so you can see what I'm talking about.

sqlnews = " Select newsID, empID, title, Convert(char,Content) content, 
area, Convert(char,briefDesc) briefDesc, liveDate, archDate, type From 
news ORDER BY liveDate DESC"
- This will return all information to the array, but the text fields
(content and briefDesc) only contain around 50 characters apiece.

sqlnews = " Select newsID, empID, title, content, area, briefDesc, 
liveDate, archDate, type From news ORDER BY liveDate DESC"
- This returns only the information up to a text type as described above.

sqlnews = " Select * From news ORDER BY liveDate Desc "
- This returns only the information up to a text type as described above. 
However, before I made the most recent changes to the application this is 
what I was using and it worked fine.


Thanks in advance for taking a look at this for me. I'm hoping that I'm 
not just doing something stupid in my code. I've tried running the 
application on different databases and web servers(with identical 
configurations) and experience the same problem. Has anyone seen anything 
like this before? If you'd like to take a look at the application, I'd be 
MORE than happy to send it to you, it's just a little too large to post 
directly onto the boards.
Thanks again for your time!
-Ted Hekman
thekman@w...
Message #2 by "Ken Schaefer" <ken@a...> on Wed, 11 Sep 2002 13:26:19 +1000
Please look through the archives for the list. This was covered a few days
ago

The thread was titled:Cursortype problems using GetRows method. The original
poster was Mike Taylor <michaelctaylor@j...>

a) the following helps:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q200124&
Accessing Text or Memo Fields in ASP Returns No Data

b) If you really need to use Text fields, then use bound columns and
.AppendChunk. I think I posted some sample code on how to do that as part of
the thread mentioned above.

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: <thekman@w...>
Subject: [asp_databases] SQL data not being entered properly into an array


: Greetings all. I'm having a problem that has befuddled me and many
: programmers at my place of business. Hopefully one of you has seen this
: before and may be able to point me in the right direction.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.

Message #3 by thekman@w... on Wed, 11 Sep 2002 16:08:55
Thanks Ken, your information in the previous posting was very helpful to 
me, as was Microsoft's information that you pointed out. I wasn't able to 
fix my issue with moving the fields to the back of the select string, but 
I was able to correct it with the .GetChunk and .AppendChunk methods. 
Thanks again for helping out. You're the best.
-Ted Hekman

  Return to Index