Sp方法错误,请帮我:( [英] Wrong in Sp method help me please :(

查看:101
本文介绍了Sp方法错误,请帮我:(的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此方法有什么问题????

据我所知,

what''s the wrong in this method ????

public void ApplyNoneQuerySP(string ProcName, string[] param, object[] value)
{
cmd = new SqlCommand(ProcName,cnn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue(param, value);
cnn.Open();
int rows = cmd.ExecuteNonQuery();
cnn.Close();
}

推荐答案

AddWithValue不能将字符串[]作为参数.

您需要更改传递"string []参数,object []值"的方式.
到AddWithValue
AddWithValue cannot take a string[] as a parameter as far as I know.

You''ll need to change the way you pass "string[] param, object[] value"
to the AddWithValue


http: //msdn.microsoft.com/zh-CN/library/system.data.sqlclient.sqlparametercollection.addwithvalue.aspx [

这篇关于Sp方法错误,请帮我:(的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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