Ken H

Ken H

  • NA
  • 646
  • 360.2k

Remove the specified array element

Apr 6 2014 7:26 AM
 Hi friend,
Because when i get a stored procedure parameter information, the first (index for 0) element is provided by default and now I do not need it.
 
 
public static SqlParameter[] GetParametes(string sProcedureName, string connString) {
SqlParameter[] parms;
SqlConnection conn;
using (conn = new SqlConnection(connString))
{
SqlCommand cmd = new SqlCommand(sProcedureName, conn);
cmd.CommandType = CommandType.StoredProcedure;
conn.Open();
SqlCommandBuilder.DeriveParameters(cmd);
parms = new SqlParameter[cmd.Parameters.Count];
for (int i = 0; i < cmd.Parameters.Count; i++)
{
parms[i]=new SqlParameter();
parms[i].ParameterName=cmd.Parameters[i].ParameterName;
parms[i].SqlDbType=cmd.Parameters[i].SqlDbType;
parms[i].Size=cmd.Parameters[i].Size;
}
}
conn.Close();
conn.Dispose();
/*
Remove parms[0] ?
*/
return parms;
}
 
Thanks. 

Answers (2)