public int Update(ViewDataSet.品號ViewDataTable table) { OleDbDataAdapter adapter = new OleDbDataAdapter(); adapter.UpdateCommand = UpdateCommand; adapter.InsertCommand = InsertCommand; adapter.DeleteCommand = DeleteCommand; this.Connection.Open(); OleDbTransaction trans = this.Connection.BeginTransaction(); adapter.InsertCommand.Transaction = trans; adapter.UpdateCommand.Transaction = trans; adapter.DeleteCommand.Transaction = trans; try { int count = 0; count = adapter.Update(table); trans.Commit(); return(count); } catch (System.Exception ex) { trans.Rollback(); throw ex; } finally { this.Connection.Close(); } }
public virtual ViewDataSet.品號ViewDataTable GetAll() { this.Adapter.SelectCommand = this.CommandCollection[2]; ViewDataSet.品號ViewDataTable dataTable = new ViewDataSet.品號ViewDataTable(); this.Adapter.Fill(dataTable); return dataTable; }
public virtual ViewDataSet.品號ViewDataTable GetBy系列編號(int 系列編號) { this.Adapter.SelectCommand = this.CommandCollection[0]; this.Adapter.SelectCommand.Parameters[0].Value = ((int)(系列編號)); ViewDataSet.品號ViewDataTable dataTable = new ViewDataSet.品號ViewDataTable(); this.Adapter.Fill(dataTable); return dataTable; }