1
Answer

.net

anil john

anil john

12y
1.8k
1
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)