新手问题
我是新手,看不懂这几个函数的区别及他们的作用,希望哪位高手给我讲解一下,谢了public static SqlCommand CreatCmd(string procName, SqlParameter[] prams)
{
SqlConnection SqlConn = ReturnConn();
SqlCommand Cmd = new SqlCommand();
= CommandType.StoredProcedure;
Cmd.Connection = SqlConn;
= procName;
if (prams != null)
{
foreach (SqlParameter paramenter in prams)
{
if (paramenter != null)
{
Cmd.Parameters.Add(paramenter);
}
}
}
return Cmd;
}
public static SqlCommand CreatCmd(string procName, SqlConnection Conn)
{
SqlConnection SqlConn = Conn;
if (SqlConn.State.Equals(ConnectionState.Closed))
{
SqlConn.Open();
}
SqlCommand Cmd = new SqlCommand();
= CommandType.StoredProcedure;
Cmd.Connection = SqlConn;
= procName;
return Cmd;
}
public static SqlCommand CreatCmd(string procName)
{
SqlConnection SqlConn =ReturnConn();
SqlCommand Cmd = new SqlCommand();
= CommandType.StoredProcedure;
Cmd.Connection = SqlConn;
= procName;
return Cmd;