/// <summary>
/// Create new SqlComand which has Parameters,Set Stored Procedure Flag
/// </summary>
/// <param></param>
/// <param></param>
/// <param></param>
/// <returns></returns>
public static SqlCommand CreateCommand(string strSql, SqlParameter[] sqlParameters, bool bIsStoredProcedure)
{
SqlCommand sqlcmd = new SqlCommand(strSql);
if (bIsStoredProcedure)
sqlcmd.CommandType = CommandType.StoredProcedure;
else
sqlcmd.CommandType = CommandType.Text;
foreach (SqlParameter param in sqlParameters)
{
sqlcmd.Parameters.Add(param);
}
return sqlcmd;
}
/// <summary>
/// Create new SqlComand which has Parameters,Set Stored Procedure Flag and DataBase Connection
/// </summary>
/// <param></param>
/// <param></param>
/// <param></param>
/// <returns></returns>
public static SqlCommand CreateCommand(string strSql, SqlParameter[] sqlParameters, bool bIsStoredProcedure, SqlConnection sqlconn)
{
SqlCommand sqlcmd = new SqlCommand(strSql, sqlconn);
if (bIsStoredProcedure)
sqlcmd.CommandType = CommandType.StoredProcedure;
else
sqlcmd.CommandType = CommandType.Text;
foreach (SqlParameter param in sqlParameters)
{
sqlcmd.Parameters.Add(param);
}
return sqlcmd;
}
/// <summary>
/// Create new SqlDataAdapter which has Parameters and set DataBase Connection
/// </summary>
/// <param></param>
/// <param></param>
public static SqlDataAdapter CreateDataAdapter(string strSql, SqlParameter[] sqlParameters, SqlConnection sqlconn)
{
SqlDataAdapter sqlda = new SqlDataAdapter(strSql, sqlconn);
foreach (SqlParameter param in sqlParameters)
{
sqlda.SelectCommand.Parameters.Add(param);
}
return sqlda;
}
/// <summary>
/// Create new SqlDataAdapter which has Parameters,Set Stored Procedure Flag and DataBase Connection
/// </summary>
/// <param></param>
/// <param></param>
/// <param></param>
/// <returns></returns>
public static SqlDataAdapter CreateDataAdapter(string strSql, SqlParameter[] sqlParameters, bool bIsStoredProcedure, SqlConnection sqlconn)
{
SqlDataAdapter sqlda = new SqlDataAdapter(strSql, sqlconn);