/// <summary> /// Adds a new parameter to the specified command. /// </summary> /// <param name="cmd">The <see cref="System.Data.IDbCommand"/> object to add the parameter to.</param> /// <param name="paramName">The name of the parameter.</param> /// <param name="value">The value of the parameter.</param> /// <returns>A reference to the added parameter.</returns> protected virtual IDbDataParameter AddParameter(IDbCommand cmd, string paramName, object value) { IDbDataParameter parameter; switch (paramName) { case "@Thread_ID": parameter = _db.AddParameter(cmd, paramName, DbType.Int32, value); break; case "@Title": parameter = _db.AddParameter(cmd, paramName, DbType.String, value); break; case "@Thread_isForcus": parameter = _db.AddParameter(cmd, paramName, DbType.Boolean, value); break; case "@Thread_Logo": parameter = _db.AddParameter(cmd, paramName, DbType.String, value); break; case "@Thread_RT": parameter = _db.AddParameter(cmd, paramName, DbType.String, value); break; case "@Thread_RC": parameter = _db.AddParameter(cmd, paramName, DbType.Int32, value); break; case "@Status": parameter = _db.AddParameter(cmd, paramName, DbType.Int32, value); break; default: throw new ArgumentException("Unknown parameter name (" + paramName + ")."); } return(parameter); }
public DataTable NewsPublished_GetNewsModeByCat(string Cat_ID) { IDbCommand cmd = _db.CreateCommand("NewsPublished_GetNewsModeByCat", true); _db.AddParameter(cmd, "Cat_ID", DbType.String, Cat_ID); DataTable table = _db.CreateDataTable(cmd); return(table); }
public DataTable proc_CategoryLayout_Insert(int Cat_ID, int CellIndex, int ProductID) { IDbCommand cmd = _db.CreateCommand("proc_CategoryLayout_Insert", true); _db.AddParameter(cmd, "Cat_ID", DbType.Int32, Cat_ID); _db.AddParameter(cmd, "CellIndex", DbType.Int32, CellIndex); _db.AddParameter(cmd, "ProductID", DbType.Int32, ProductID); DataTable table = _db.CreateDataTable(cmd); return(table); }