F
fruddy
Hi everyone,
I'm running the following code for an ASP / SQL Server site
on several pages:
--------------------------------------------------------
txtContent = CStr(RSSQL("Content"))
if len(txtContent) > 0 then
txtContent = replace(RSSQL("Content"),"`", "'")
end if
--------------------------------------------------------
Yet I get this error:
Microsoft VBScript runtime error '800a005e'
Invalid use of Null: 'replace'
Which is ok as I can error handle with the following code:
--------------------------------------------------------
if len(txtContent) > 0 then
if txtContent <> null then
txtContent = replace(RSSQL("Content"),"`", "'")
end if
end if
--------------------------------------------------------
How can txtContent be null? It's definitely not null, well at least when
I view the query in query analyser. It is to be noted that
RSSQL("Content") is an ntext field.
The query for RSSQL is:
--------------------------------------------------------
SQLHomePage = "Select * from Pages where Title = 'Home page' and Status
= 'Approved'"
Set RSSQL = con.Execute(SQLHomePage)
--------------------------------------------------------
My environment is
IIS 6.0
Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
The part I find strange, is that when this code is being run in another
environment they are not getting this error at all?
I've read that this can be caused by not selecting the ntext fields in a
particular order is that correct? Basically you should select the ntext
fields last.. But why wouldn't this be occuring in all environments? Is
it a SQL version difference?
I'm running the following code for an ASP / SQL Server site
on several pages:
--------------------------------------------------------
txtContent = CStr(RSSQL("Content"))
if len(txtContent) > 0 then
txtContent = replace(RSSQL("Content"),"`", "'")
end if
--------------------------------------------------------
Yet I get this error:
Microsoft VBScript runtime error '800a005e'
Invalid use of Null: 'replace'
Which is ok as I can error handle with the following code:
--------------------------------------------------------
if len(txtContent) > 0 then
if txtContent <> null then
txtContent = replace(RSSQL("Content"),"`", "'")
end if
end if
--------------------------------------------------------
How can txtContent be null? It's definitely not null, well at least when
I view the query in query analyser. It is to be noted that
RSSQL("Content") is an ntext field.
The query for RSSQL is:
--------------------------------------------------------
SQLHomePage = "Select * from Pages where Title = 'Home page' and Status
= 'Approved'"
Set RSSQL = con.Execute(SQLHomePage)
--------------------------------------------------------
My environment is
IIS 6.0
Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
The part I find strange, is that when this code is being run in another
environment they are not getting this error at all?
I've read that this can be caused by not selecting the ntext fields in a
particular order is that correct? Basically you should select the ntext
fields last.. But why wouldn't this be occuring in all environments? Is
it a SQL version difference?