SQL Server的文本列会影响结果返回给传统的ASP [英] SQL Server text column affects results returned to classic ASP

查看:115
本文介绍了SQL Server的文本列会影响结果返回给传统的ASP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用传统的ASP,我想查询SQL Server数据库中,像这样:

Using classic asp, I am trying to query a SQL Server database like so:

strSQL = "select column_1, column_2, column_3, column_4  from someview " &_
         "where RecordNo=" & i
set rs=conn.Execute(strSQL)

if not rs.eof then
    A = rs("column_1")
    B = rs("column_2")
    C = rs("column_3")
    D = rs("column_4")
end if

Col​​umn_3是NTEXT类型,其他列VARCHAR或INT(有时可能有超过4列返回),但查询只返回因为where子句的1记录。

Column_3 is an NText type, the other columns are varchar or int (sometimes there may be more than 4 columns returned) but the query only returns 1 record because of the where clause.

在ASP页的结果有所不同 - 有时A,B,D被填充,有时没有 - 但在视图中的所有列中包含的数据(当我查询的SQL Server我看到预期的结果 - 所有列不包含数据) 。如果我删除column_3这是NTEXT从STRSQL一切工作正常。

On the ASP page the results vary - sometimes A,B,D are populated, sometimes not - but all columns in the view contain data (when I query the SQL Server I see the expected results - all columns do contain data). If I remove column_3 which is NText from the strSQL everything works fine.

我已经看到了在过去的几个其他页面此行为。如果我修改ASP获得column_3分开:

I've seen this behaviour on a couple other pages in the past. If I modify the ASP to get column_3 separately:

 strSQL = "select column_3 from someview where RecordNo=" & i

ntext数据正确返回。

The NText data is returned correctly.

有一个最大记录长度以返回到传统的ASP一个SQL Server记录?除了分裂出来的NTEXT成一个单独的查询,还有什么我能做什么?

Is there a maximum record length to a SQL Server recordset returned to classic ASP? Apart from splitting out the NTEXT into a separate query, is there anything else I can do?

编辑:这只是发生在我尝试改变连接字符串 - 受此启发<一个href=\"http://stackoverflow.com/questions/661437/classic-asp-sql-query-returns-two-columns-out-of-ten#comment-475140\">comment对类似的问题 - 连接是通过SQL Server ODBC驱动程序(驱动程序= {SQL服务器};)

It just occured to me to try changing the connection string - inspired by this comment on a similar problem - the connection is via SQL Server ODBC Driver (Driver={SQL Server};).

推荐答案

我有这个问题。微软承认它放在他们的网站上。

I have had this problem. Microsoft acknowledge it somewhere on their website.

如果你把ntext列末页在SELECT列表中,您将能够访问它确定。
但是,您的code不能在已经阅读了NTEXT值访问任何其他列的。一旦你移动到记录的下一行再次确定是。

If you put the NText column last in the SELECT list, you will be able to access it ok. However, your code cannot access any other columns after it has read the NText value. Once you move to the next row of the recordset you're OK again.

最好的办法是改变虽然你的连接字符串,并用更现代的东西。这解决的最佳途径的问题!

Best solution is to change your connection string though, and use something more modern. That solves the problem in the best way!

这篇关于SQL Server的文本列会影响结果返回给传统的ASP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆