本文介绍了nvarchar(max)字段和Classic ASP的奇怪问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个经典ASP(VBScript)网站,该网站在 Windows 2008 服务器上运行 IIS7 并点击 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?

推荐答案

如果您看一下这个链接,它说启用SQL Server Native Client获取最新的功能,例如在SQL2005中引入的varchar(max),所以我想即使你使用的是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)字段和Classic ASP的奇怪问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 13:19