anil john

anil john

  • NA
  • 156
  • 210.4k

.net

Aug 20 2012 5:17 AM
Can you explain this code?specially this params SqlParameter[] parms ?

public int insUpdata(string procName, params SqlParameter[] parms)
        {
            //cmd.Connection = conSql;
            OpenConnection();
            cmd = new SqlCommand(procName, conSql);
            if (parms != null)
            {
                foreach (SqlParameter p in parms)
                {
                    if ((p.Direction == ParameterDirection.InputOutput) && (p.Value == null))
                    {
                        p.Value = DBNull.Value;
                    } cmd.Parameters.Add(p);


                }
            }
            cmd.CommandType = CommandType.StoredProcedure;
            int iStatus = cmd.ExecuteNonQuery();
            CloseConnection();
            return iStatus;
        }

Answers (1)