PDA

View Full Version : سوال: فرستادن پارامترهای storedprocedure



EMANOEL
دوشنبه 08 مهر 1387, 23:39 عصر
سلام
یه مشکل حادی برای من در مورد استفاده ازstoredprocedureپیش اومده.وقتی میخوام پارامترهارو به کلاس پایه باکد زیربفرستم با مشکل مواجه میشم:
کد:
SqlParameter[] obj = new SqlParameter[4];
dbbase db = new dbbase();
db.Execute("Sp_Customer_insert", obj);
کلاس db:
public class dbbase
{
private static string _connection = "server=localhost;database=first;integrated security=SSPI;";
DataSet ds=new DataSet();
SqlCommand com=new SqlCommand();
SqlDataAdapter da=new SqlDataAdapter();
SqlConnection con=new SqlConnection(_connection);
public void Execute(string storedprocedurename, object[] parameters)
{
da.SelectCommand = com;

da.SelectCommand.Connection = con;
da.SelectCommand.CommandText = storedprocedurename;
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.SelectCommand.Parameters.Add(parameters);

da.Fill(ds,"Customer");
}
error:
The SqlParameterCollection only accepts non-null SqlParameter type objects, not Object[] objects.
این خط مشکل داره:
da.SelectCommand.Parameters.Add(parameters
خواهشمندم سریع کمکم کنید:عصبانی++: