Is there some way to pass a table-valued parameter to a stored procedure in SQL Server via classic ADO?
是否有一些方法可以通过经典的ADO将表值参数传递给SQL服务器中的存储过程?
2 个解决方案
#1
5
I thought they were new in 2008?
我以为他们是2008年的新人?
Anyway, I think the answer is going to be no, I doubt there's a DataTypeEnum value that you'll be able to bend to your needs.
无论如何,我认为答案是否定的,我怀疑是否有数据类型枚举值可以满足您的需要。
So if I may suggest an alternative, I guess what you want to do is pass some sort of structured data into the stored procedure. I have done this before in ADO using XML:
因此,如果我可以建议另一种方法,我猜您需要做的是将某种结构化数据传递到存储过程中。我以前在ADO中使用过XML:
- define the parameter in the stored proc as type xml
- 将存储proc中的参数定义为类型xml。
- define the parameter in ADO as type adLongVarChar with a length = len(xml) + 1
- 将ADO中的参数定义为具有长度= len(xml) + 1的adLongVarChar类型
I know it's not what you wanted, but it's a method that works
我知道这不是你想要的,但这是一种有效的方法
#2
6
Classic ADO is COM and OLE and the SQL Native Client supports Table Valued Parameters over OleDB, see Table-Valued Parameters (OLE DB). One would have to get its hand dirty and code straight to the OleDB interfaces (in C/C++).
经典ADO是COM和OLE, SQL本机客户端支持OleDB上的表值参数,参见表值参数(OLE DB)。你必须把它的手弄脏并且直接编码到OleDB接口(用C/ c++)。
Also TVPs are only in SQL 2008, so you won't be able to use them in SQL 2005.
而且TVPs只能在SQL 2008中使用,所以你不能在SQL 2005中使用它们。
BTW, for completness here is the Table Valued Parameters (ODBC) reference, for the ODBC nostalgics out there...
顺便说一句,这里是表值参数(ODBC)引用,这里是ODBC怀旧。
#1
5
I thought they were new in 2008?
我以为他们是2008年的新人?
Anyway, I think the answer is going to be no, I doubt there's a DataTypeEnum value that you'll be able to bend to your needs.
无论如何,我认为答案是否定的,我怀疑是否有数据类型枚举值可以满足您的需要。
So if I may suggest an alternative, I guess what you want to do is pass some sort of structured data into the stored procedure. I have done this before in ADO using XML:
因此,如果我可以建议另一种方法,我猜您需要做的是将某种结构化数据传递到存储过程中。我以前在ADO中使用过XML:
- define the parameter in the stored proc as type xml
- 将存储proc中的参数定义为类型xml。
- define the parameter in ADO as type adLongVarChar with a length = len(xml) + 1
- 将ADO中的参数定义为具有长度= len(xml) + 1的adLongVarChar类型
I know it's not what you wanted, but it's a method that works
我知道这不是你想要的,但这是一种有效的方法
#2
6
Classic ADO is COM and OLE and the SQL Native Client supports Table Valued Parameters over OleDB, see Table-Valued Parameters (OLE DB). One would have to get its hand dirty and code straight to the OleDB interfaces (in C/C++).
经典ADO是COM和OLE, SQL本机客户端支持OleDB上的表值参数,参见表值参数(OLE DB)。你必须把它的手弄脏并且直接编码到OleDB接口(用C/ c++)。
Also TVPs are only in SQL 2008, so you won't be able to use them in SQL 2005.
而且TVPs只能在SQL 2008中使用,所以你不能在SQL 2005中使用它们。
BTW, for completness here is the Table Valued Parameters (ODBC) reference, for the ODBC nostalgics out there...
顺便说一句,这里是表值参数(ODBC)引用,这里是ODBC怀旧。