public int Insert(VoteItemInfo itemInfo) { var voteItemId = 0; IDataParameter[] parms = null; var sqlInsert = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(itemInfo.ToNameValueCollection(), ConnectionString, TableName, out parms); using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { voteItemId = ExecuteNonQueryAndReturnId(trans, sqlInsert, parms); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(voteItemId); }
public void Update(VoteItemInfo itemInfo) { IDataParameter[] parms = null; var SQL_UPDATE = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(itemInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms); ExecuteNonQuery(SQL_UPDATE, parms); }
public int Insert(VoteItemInfo itemInfo) { var voteItemID = 0; IDataParameter[] parms = null; var SQL_INSERT = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(itemInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms); using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { ExecuteNonQuery(trans, SQL_INSERT, parms); voteItemID = BaiRongDataProvider.DatabaseDao.GetSequence(trans, TABLE_NAME); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(voteItemID); }
public void Update(VoteItemInfo itemInfo) { IDataParameter[] parms = null; var sqlUpdate = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(itemInfo.ToNameValueCollection(), ConnectionString, TableName, out parms); ExecuteNonQuery(sqlUpdate, parms); }