Click here to Skip to main content
15,922,015 members
Home / Discussions / Database
   

Database

 
GeneralCreating Database with ADO Pin
yamini20-Feb-01 19:40
yamini20-Feb-01 19:40 
Generalreturning the primarykey from the last modified record Pin
marcjlandy11-Feb-01 13:46
marcjlandy11-Feb-01 13:46 
GeneralSQL Server Identity field Pin
Kostas Stefanou3-Feb-01 5:23
Kostas Stefanou3-Feb-01 5:23 
GeneralRe: SQL Server Identity field Pin
Anders Molin4-Feb-01 22:39
professionalAnders Molin4-Feb-01 22:39 
GeneralRe: SQL Server Identity field Pin
11-Feb-01 20:16
suss11-Feb-01 20:16 
GeneralCrazy question Pin
Jamie Nordmeyer25-Jan-01 11:05
Jamie Nordmeyer25-Jan-01 11:05 
GeneralRe: Crazy question Pin
Anders Molin26-Jan-01 4:41
professionalAnders Molin26-Jan-01 4:41 
GeneralRe: Crazy question Pin
Jamie Nordmeyer30-Jan-01 5:11
Jamie Nordmeyer30-Jan-01 5:11 
My application tracks the amount of time that one of my company's agents spends on a particular project. Everything is fine and dandy until it comes time to compile a bill. The application query's the SQLServer database for all records whose 'BillID' is 0, meaning that it hasn't been billed yet (when a record is billed, it'll get a new BillID). The application uses this disconnected recordset to build an Excel spreadsheet. The third and final step of the billing process is to go back and update the 'BillID' fields of the billed records.

This should work 99.9% of the time. Where this plan fails is if another agent adds a new record to the database in the middle of the billing cycle. For example, a record might be added during the Excel phase (if you've ever done anything with the Excel Object Library, you know that it takes a few seconds to build a substantial report). When the application goes back to update the database, the new record will have a 'BillID' of 0, since it's a new record and hasn't been billed, and will thus be updated with a new 'BillID'. This is bad, because the new record hasn't really been billed (it wasn't added to the report). The whole process works like this in summary:

1. Get disconnected recordset containing all records whose 'BillID' is 0
2. Compile an Excel Spreadsheet based on this recordset
3. Set all records whose 'BillID' is 0 to a new non-zero number (here is where a record might be mis-billed)

My solution for the time being was to add a couple of methods to my 'Update' COM Object (I have two objects, Query and Update) called BeginBilling and EndBilling that look like this (in VB):

Public Sub BeginBilling()
GetObjectContext.DisableCommit
End Sub

Public Sub EndBilling()
GetObjectContext.EnableCommit
End Sub

I call BeginBilling at the start of the billing process to prevent MTS from closing the transaction (some what wrapping the Excel procedure in the transaction), and then calling EndBilling when everythings has completed. This seems somewhat hoky to me, though, and thus, the posted question.

Jamie Nordmeyer
Portland, Oregon, USA
GeneralRe: Crazy question Pin
Chris Meech30-Jan-01 6:48
Chris Meech30-Jan-01 6:48 
GeneralRe: Crazy question Pin
Jamie Nordmeyer30-Jan-01 7:37
Jamie Nordmeyer30-Jan-01 7:37 
GeneralRe: Crazy question Pin
Colin Angus Mackay11-Oct-04 2:35
Colin Angus Mackay11-Oct-04 2:35 
GeneralRe: Crazy question Pin
Anders Molin11-Oct-04 2:48
professionalAnders Molin11-Oct-04 2:48 
GeneralRe: Crazy question Pin
Chris Meech26-Jan-01 4:41
Chris Meech26-Jan-01 4:41 
GeneralNew ADO.NET Article Pin
Griffo18-Jan-01 9:30
Griffo18-Jan-01 9:30 
QuestionWhy can't I set a connectionString? Pin
Dave Midgley17-Jan-01 23:16
Dave Midgley17-Jan-01 23:16 
AnswerRe: Why can't I set a connectionString? Pin
26-Jan-01 4:54
suss26-Jan-01 4:54 
GeneralLooking for young SQL programmer Pin
14-Jan-01 11:27
suss14-Jan-01 11:27 
QuestionWhat database type to choose? Pin
2-Jan-01 4:32
suss2-Jan-01 4:32 
AnswerRe: What database type to choose? Pin
Anders Molin2-Jan-01 23:37
professionalAnders Molin2-Jan-01 23:37 
GeneralSQL Server connections to backend server failing Pin
Chris Maunder5-Dec-00 8:47
cofounderChris Maunder5-Dec-00 8:47 
GeneralRe: SQL Server connections to backend server failing Pin
Anders Molin27-Dec-00 15:14
professionalAnders Molin27-Dec-00 15:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.