ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old March 17th, 2008, 06:31 AM
loop loop is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 4 loop User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 37 sec
Reputation Power: 0
Problem with asp

Hi

I am trying to retrieve some data from sql server as follows:

Code:
SQL = "select * from news where postdate<=getdate() and getdate()<=enddate and sn ="&sn
DIM RS
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open SQL, ADO


then I tried to show the output as follows:

Code:
<%=RS("title")%> 

this works fine


Code:
<%=RS("body")%>  

but this line dose not show any results nor an error. the data type of the "body" field is ntext inside the sql server.

I did not face this problem when I was using the MS Access.

Any idea of what is going wrong.


Thanks

Reply With Quote
  #2  
Old March 17th, 2008, 06:38 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 956 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 8 h 23 m 32 sec
Reputation Power: 4
Send a message via ICQ to Itsacon
Does the column `body' exist?

If so, try casting it to a string before outputting it (CStr(RS("body")))
__________________
This is my code. Is it not nifty?

"The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools."
---Douglas Adams


Join the Itsacon fanclub!    
Zero Tolerance: Spammers banned so far: 264

Reply With Quote
  #3  
Old March 17th, 2008, 06:45 AM
loop loop is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 4 loop User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 37 sec
Reputation Power: 0
Quote:
Originally Posted by Itsacon
Does the column `body' exist?

If so, try casting it to a string before outputting it (CStr(RS("body")))


Yes, it exists.

I tried your solution to cast to a string but still not working.

Reply With Quote
  #4  
Old March 17th, 2008, 07:38 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 956 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 8 h 23 m 32 sec
Reputation Power: 4
Send a message via ICQ to Itsacon
Check if the data gets assigned properly by seeing if it is Null (with the IsNull()) function or Empty (with the IsEmpty() function)

Reply With Quote
  #5  
Old March 17th, 2008, 08:09 AM
loop loop is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 4 loop User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 37 sec
Reputation Power: 0
It dose not give null but also gives zero length when I tried len(RS("body")).

How dose it come when I convert the data type of the "body" field from ntext to varchar it shows the contents of the body.

Reply With Quote
  #6  
Old March 17th, 2008, 08:16 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 956 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2Folding Points: 648707 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 8 h 23 m 32 sec
Reputation Power: 4
Send a message via ICQ to Itsacon
Ah, missed the ntext part.

I don't think VBScript strings support multibyte characters, so I'm afraid you'll either have to convert your database to text columns (or Varchar, if less than 8000 bytes), or switch to ASP.NET.

Reply With Quote
  #7  
Old March 23rd, 2008, 08:35 AM
loop loop is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 4 loop User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 37 sec
Reputation Power: 0
Finally, I found the solution.

The solution is to write the column name which has 'text' or 'ntext' as a data type at the end of the column collection that you want to retrieve.

Example:

"select title, postdate, body from news" where the 'body' column is a 'ntext' data type. This will wroks fine.


But this will not work:
"select title, body , postdate from news"


I know it is stupid but it works

try Microsoft support about: "Accessing Text or Memo Fields in ASP Returns No Data"

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Problem with asp


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway