我可以从一个存储过程返回一个varchar(最大值)?最大值、存储过程、varchar

由网友(灿烂阳光下的向日葵)分享简介:VB.net网络系统和SQL Server 2005后端。我有一个存储过程返回一个varchar和我们最终得到的将不适合用VARCHAR(8000)值。VB.net web system with a SQL Server 2005 backend. I've got a stored procedure tha...

VB.net网络系统和SQL Server 2005后端。我有一个存储过程返回一个varchar和我们最终得到的将不适合用VARCHAR(8000)值。

VB.net web system with a SQL Server 2005 backend. I've got a stored procedure that returns a varchar, and we're finally getting values that won't fit in a varchar(8000).

我返回参数更改为VARCHAR(最大值),但我怎么告诉OleDbParameter.Size物业接受任意数量的文本?

I've changed the return parameter to a varchar(max), but how do I tell the OleDbParameter.Size Property to accept any amount of text?

作为一个具体的例子,这得到了使用存储过程返回参数的VB code的样子:

As a concrete example, the VB code that got the return parameter from the stored procedure used to look like:

objOutParam1 = objCommand.Parameters.Add("@RStr", OleDbType.varchar)
objOutParam1.Size = 8000
objOutParam1.Direction = ParameterDirection.Output

我可以.Size用一个(最大)工作?

What can I make .Size to work with a (max)?

更新:

要回答一些问题:

对于所有意图和目的,本文都需要走出来的一大块。 (改变,将采取更多的结构性的工作比我想做的事情 - 或者我授权,真的)

For all intents and purposes, this text all needs to come out as one chunk. (Changing that would take more structural work than I want to do - or am authorized for, really.)

如果我不设置大小,我得到一个错误读字符串[6]:Size属性为0无效大小

If I don't set a size, I get an error reading "String[6]: the Size property has an invalid size of 0."

推荐答案

Upvoted埃德Altofer。 (他回答第一,所以如果你喜欢我的答案投票他太)。

Upvoted Ed Altofer. (He answered first, so if you like my answer vote his too).

OleDb的是你的问题。这是一个需要谈谈不仅仅是SQL Server的一个通用的数据库连接,并作为一个结果,你在那里只最弱的复合功能集可以完全支持的最小公分母的局面。其中一个失去功能为varchar(最大值)的支持。

OleDb is your problem. It's a generic database connection that needs to talk to more than just SQL Server, and as a result you have a lowest common denominator situation where only the weakest composite feature set can be fully supported. One of the lost features is varchar(max) support.

您使用的是SQL Server 2005和VB.Net。什么是使用System.Data.SqlClient的而不是System.Data.OleDb阻止你?

You're using SQL Server 2005 and VB.Net. What's stopping your from using System.Data.SqlClient rather than System.Data.OleDb?

修改 我发现在这个问题上的文档。在这里看到: http://msdn.microsoft.com/en-us/library/ms131035.aspx

Edit I found the documentation on the issue. See here: http://msdn.microsoft.com/en-us/library/ms131035.aspx

相关部分:

返回数据类型的 VARCHAR(最大),为nvarchar(max),VARBINARY(最大值),XML,UDT 或其他大型对象类型的值不能早于SQL Server返回到客户端版本2005。如果你想使用这些类型的返回值,则必须使用SQL Server本机客户端。

Return values of data type varchar(max), nvarchar(max), varbinary(max), xml, udt, or other large object types can not be returned to client versions earlier than SQL Server 2005. If you wish to use these types as return values, you must use SQL Server Native Client.

阅读全文

相关推荐

最新文章