小编yun*_*yev的帖子

对存储过程的调用什么都不返回

我在sql server上调用存储过程,如下所示:

SqlConnection conn = new SqlConnection();
SqlCommand cmd;
XmlDocument xmlDocument;
XmlReader xr;
XmlNode node;
SqlDataReader rdr = null;

try
{
    xmlDocument = new XmlDocument();
    conn.ConnectionString = "Data Source=test;Initial Catalog=teste;Integrated Security=SSPI;";
    cmd = new SqlCommand();
    cmd.Connection = conn;
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.CommandText = "[dbo].[spSearchKeywords]";

    cmd.Parameters.Add(new SqlParameter("@VALUE", "XPT"));

    conn.Open();

    xr = cmd.ExecuteXmlReader();

    conn.Close();
    node = xmlDocument.ReadNode(xr);
}
Run Code Online (Sandbox Code Playgroud)

它连接并执行命令,但它没有返回任何数据返回和参数是正确的(当我在sql中使用相同的参数调用该过程时,它返回给我一个结果)

这是proc:

ALTER PROCEDURE [dbo].[spSearchKeywords]
(
    @VALUE                 NVARCHAR(50)  = NULL,
    @ACCOUNTGROUPID         NVARCHAR(50)  = NULL,
    @ShortCodeId         NVARCHAR(50)  = NULL,
    @VALUETYPE             NVARCHAR(50)  = NULL,
    @ASSEMBLY             NVARCHAR(100) …
Run Code Online (Sandbox Code Playgroud)

c# sql-server ado.net stored-procedures

2
推荐指数
1
解决办法
714
查看次数

标签 统计

ado.net ×1

c# ×1

sql-server ×1

stored-procedures ×1