A problem with text not displaying on an ASP page when using a SQL database
Alongside my daily work as a search engine optimisation specialist I’m very much involved with the design and development of websites. For the development of dynamic database driven websites and applications my programming language of choice is ASP (Active Server Pages). However, for a long time now I’ve always been plagued by a very irritating SQL/ASP ism which I’ve never been able to find a definitive answer for, until now.
The Problem
Sometimes when connecting to a SQL Server 2000 database using asp I found that for no apparent reason some of the text fields failed to display their information on screen, even though the recordset contained data.
The Cause
To be honest I’m not sure about the technical in’s and out’s of this problem but I’ve finally managed to work out that it relates to the datatypes nText or Text, particularly when nVarchar or Varchar are also used in the same recordset query statement.
The Solution
Simply move any nText or Text datatype fields to the end of the SQL recordset query statement. The result is that all the information contained in the recordset will now correctly display on screen.
I’ve only recently discovered this and I’m still in the process of testing the theory out but so far I’ve found it to work.
Tags: ASP, SQL, Web Development










