SqlParameter[] clonedParms = new SqlParameter[sqlParameters.Length];
for (int i = 0, j = sqlParameters.Length; i < j; i++)
{
clonedParms[i] = (SqlParameter)((ICloneable)sqlParameters[i]).Clone();
}
return clonedParms;
}
//----------------------------------------------------------------------------------------------------------------
/// <summary>
/// Create new SqlComand
/// </summary>
/// <param></param>
public static SqlCommand CreateCommand(string strSql)
{
SqlCommand sqlcmd = new SqlCommand(strSql);
return sqlcmd;
}
/// <summary>
/// Create new SqlComand,Set DataBase Connection
/// </summary>
/// <param></param>
/// <param></param>
/// <returns></returns>
public static SqlCommand CreateCommand(string strSql, SqlConnection sqlconn)
{
SqlCommand sqlcmd = new SqlCommand(strSql, sqlconn);
return sqlcmd;
}
/// <summary>
/// Create new SqlComand which has Parameters
/// </summary>
/// <param></param>
/// <param></param>
public static SqlCommand CreateCommand(string strSql, SqlParameter[] sqlParameters)
{
SqlCommand sqlcmd = new SqlCommand(strSql);
foreach (SqlParameter param in sqlParameters)
{
sqlcmd.Parameters.Add(param);
}
return sqlcmd;
}
/// <summary>
/// Create new SqlComand which has Parameters,Set DataBase Connection
/// </summary>
/// <param></param>
/// <param></param>
/// <param></param>
public static SqlCommand CreateCommand(string strSql, SqlParameter[] sqlParameters, SqlConnection sqlconn)
{
SqlCommand sqlcmd = new SqlCommand(strSql, sqlconn);
foreach (SqlParameter param in sqlParameters)
{
sqlcmd.Parameters.Add(param);
}
return sqlcmd;
}