nvarchar(max) 字段和经典 ASP 的奇怪问题 [英] Strange problem with nvarchar(max) fields and Classic ASP
问题描述
我正在开发一个经典 ASP (VBScript) 站点,该站点在带有 IIS7 的 Windows 2008 服务器上运行并运行 SQL Server 2008> 数据库,我看到一些奇怪的行为似乎特定于 nvarchar(max) 类型的字段.
I'm working on a Classic ASP (VBScript) site that's running on a Windows 2008 server with IIS7 and hitting a SQL Server 2008 database and I'm seeing some strange behavior that seems to be specific to fields that are of type nvarchar(max).
我有一段简单的代码,它会遍历一些查询结果并尝试两次打印标题字段
I have this simple bit of code that loops over some query results and tries to print out the title field twice
rs.open "SELECT * FROM thing", dbConnection
do while not rs.eof
response.write "(" & rs("title") & ")" & "(" & rs("title") & ")" & "<br />"
rs.movenext
loop
我第一次使用 rs("title")
时,我得到了值.在该循环中第一次之后的任何时候,rs("title")
都会返回一个空值.
The first time I use rs("title")
, I get the value back. Any time after the first time in that loop, rs("title")
returns a blank value.
同样,这似乎只发生在 nvarchar(max) 字段中.
Again, this only seems to happen with the nvarchar(max) fields.
谁能解释一下这种行为以及如何解决它?
Can anyone shed any light on this behavior and how to get around it?
推荐答案
如果您查看此链接,http://msdn2.microsoft.com/en-us/library/ms130978.aspx 它说启用 SQL Server Native Client 以获取最新功能,例如 varchar(max)这是在 SQL2005 中引入的,所以我认为即使您使用的是 SQL 2008,使用它也可能对您有用.
If you take a look at this link, http://msdn2.microsoft.com/en-us/library/ms130978.aspx it says to enable SQL Server Native Client to get the latest features such as varchar(max) which was was introduced in SQL2005, so I think maybe using this would work for you as well even though you're using SQL 2008.
这篇关于nvarchar(max) 字段和经典 ASP 的奇怪问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!