如何将字符串数组传递给SQL Server存储过程 [英] How to pass an array of strings to an SQL Server stored procedure
问题描述
如何将一个字符串数组传递给SQL Server存储过程,并将另一个字符串数组从存储过程返回到c#代码?
我的问题是: - 在我的项目中,我使用Microsoft Interop Word编辑ms word文件。使用此Interop,我将MS word文档中的所有单词解析为字符串数组。现在,我必须将此字符串传递给存储过程。一旦达到存储过程,我必须将这些字符串与数据库中的表进行比较,如果找到匹配项,我必须将找到字传回c#代码。
我尝试使用foreach语句将字符串数组传递给存储过程,但我不知道为什么我没有得到任何回报。
How is it possible to pass an array of strings to an SQL Server stored procedure, and return another array of strings from the stored procedure back into c# code?
My problem is :- In my project, I am using Microsoft Interop Word to edit ms word files. Using this Interop, I parsed all the word in the MS word document into a string array. Now, I have to pass this string into a stored procedure. Once this is reached at the stored procedure, I have to compare these strings with a table in the database, and if there is a match found, I have to pass back the "found" word to the c# code.
I tried the foreach statement to pass the array of strings to the stored procedure, but I don't know why I am not getting anything in return.
推荐答案
您好,
查看此链接可能对您有用。
TSQL:将数组/列表/集传递给存储过程(MS SQL Server) [ ^ ]
http:// support。 microsoft.com/kb/555266 [ ^ ]
http:/ /outcoldman.com/en/blog/show/224 [ ^ ]
http://stackoverflow.com/questions/11102358/how-to-pass-an-array-into-a-sql-server-stored-procedure [ ^ ]
http://stackoverflow.com/questions/1069311/passing-an-array-of-parameters-to-a-stored-procedure [ ^ ]
Hi,
Check this links might be useful to you.
TSQL: Passing array/list/set to stored procedure (MS SQL Server)[^]
http://support.microsoft.com/kb/555266[^]
http://outcoldman.com/en/blog/show/224[^]
http://stackoverflow.com/questions/11102358/how-to-pass-an-array-into-a-sql-server-stored-procedure[^]
http://stackoverflow.com/questions/1069311/passing-an-array-of-parameters-to-a-stored-procedure[^]
这篇关于如何将字符串数组传递给SQL Server存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!