|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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
![]() |
|
#3
|
|||
|
|||
|
Quote:
Yes, it exists. I tried your solution to cast to a string but still not working. |
|
#4
|
||||
|
||||
|
Check if the data gets assigned properly by seeing if it is Null (with the IsNull()) function or Empty (with the IsEmpty() function)
|
|
#5
|
|||
|
|||
|
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. |
|
#6
|
||||
|
||||
|
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. |
|
#7
|
|||
|
|||
|
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" |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > Problem with asp |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|