Click here to Skip to main content
15,915,702 members
Home / Discussions / Database
   

Database

 
GeneralRe: Why won't database shrink using MSDE? Pin
25-Oct-01 21:35
suss25-Oct-01 21:35 
GeneralNumeric Datatype Pin
Michael Martin24-Oct-01 20:52
professionalMichael Martin24-Oct-01 20:52 
GeneralRe: Numeric Datatype Pin
SasaT19-Nov-01 23:44
SasaT19-Nov-01 23:44 
GeneralChecking flag adFldIsNullable with Field "Attributes" property Pin
24-Oct-01 2:33
suss24-Oct-01 2:33 
GeneralSQL Query Pin
Drawil23-Oct-01 10:39
Drawil23-Oct-01 10:39 
GeneralRe: SQL Query Pin
Drawil23-Oct-01 22:07
Drawil23-Oct-01 22:07 
GeneralADO Resource pooling Pin
Alberto Richart23-Oct-01 6:20
Alberto Richart23-Oct-01 6:20 
GeneralADO BeginTrans inside a try catch block Pin
John M. Drescher22-Oct-01 6:48
John M. Drescher22-Oct-01 6:48 
I have a couple of questions about using BeginTrans() in a try catch block. Below is an example of how I use ADO to modify a record in my Application. This application was originally made to use JET and I am tyring to migrate to MSDE. When I was using JET to maintain consistancy between the records of one connection and the records of another connection in the same app using a different thread I had to flush the cache in Jet ( using a call to pJetEngine->RefreshCache( m_pConnection)) and then call BeginTrans, update the data and call CommitTrans. In JET each ConnectionPtr has a cache on the database that is independent of other open connections. Using this procedure the thread will see and modify the current data in the db and not what was cached for this connection. Do we have to do someting like this with MSDE? Is there a way to flush the cache? Also is it possible that BeginTrans / CommitTrans will throw an exception? If so how do I handle BeginTrans inside a try / catch block? Do I call RollbackTrans in each of my catch routines? Could RollbackTrans() throw an exception?



_RecordsetPtr pRst = NULL;
try
{
TESTHR(pRst.CreateInstance(__uuidof(Recordset)));

pRst->Open(_bstr_t(strQuery), m_pConnection, adOpenStatic ,
adLockOptimistic, adCmdText);

m_pConnection->BeginTrans();

int count = pRst->GetRecordCount();
if ( count == 1 ) {
// Modify record using PutCollect
}

pRst->Update();
pRst->Close();
pRst=NULL;
m_pConnection->CommitTrans();
}
catch (_com_error &e)
{
GenerateError(e.Error(), e.ErrorMessage(), e.Description(),__FILE__,__LINE__);
}
catch( CException* e)
{
GenerateError(e,__FILE__,__LINE__);
}
catch (...)
{
GenerateError(__FILE__,__LINE__);
}


GeneralRe: ADO BeginTrans inside a try catch block Pin
Wanderley M22-Oct-01 23:11
Wanderley M22-Oct-01 23:11 
GeneralRe: ADO BeginTrans inside a try catch block Pin
John M. Drescher23-Oct-01 7:14
John M. Drescher23-Oct-01 7:14 
GeneralRe: ADO BeginTrans inside a try catch block Pin
Wanderley M23-Oct-01 11:50
Wanderley M23-Oct-01 11:50 
GeneralRe: ADO BeginTrans inside a try catch block Pin
John M. Drescher23-Oct-01 12:34
John M. Drescher23-Oct-01 12:34 
GeneralRe: ADO BeginTrans inside a try catch block Pin
Wanderley M23-Oct-01 22:45
Wanderley M23-Oct-01 22:45 
GeneralSQL Server 7.0 SP3 and money datatype Pin
Michael Martin21-Oct-01 20:46
professionalMichael Martin21-Oct-01 20:46 
GeneralRe: SQL Server 7.0 SP3 and money datatype Pin
Wanderley M22-Oct-01 3:32
Wanderley M22-Oct-01 3:32 
GeneralRe: SQL Server 7.0 SP3 and money datatype Pin
Michael Martin22-Oct-01 15:32
professionalMichael Martin22-Oct-01 15:32 
GeneralMSDE 2000 Question Pin
John M. Drescher21-Oct-01 8:57
John M. Drescher21-Oct-01 8:57 
GeneralRe: MSDE 2000 Question Pin
John M. Drescher22-Oct-01 5:48
John M. Drescher22-Oct-01 5:48 
GeneralADO DataGrid, MS Access & Server-side cursors Pin
Jim Stim18-Oct-01 22:53
Jim Stim18-Oct-01 22:53 
GeneralRe: ADO DataGrid, MS Access & Server-side cursors Pin
Rashid Thadha21-Oct-01 22:40
Rashid Thadha21-Oct-01 22:40 
QuestionHow to age out subscribers accounts? Pin
Jason Jystad18-Oct-01 9:37
Jason Jystad18-Oct-01 9:37 
AnswerRe: How to age out subscribers accounts? Pin
Wanderley M19-Oct-01 8:42
Wanderley M19-Oct-01 8:42 
GeneralRe: How to age out subscribers accounts? Pin
Jason Jystad22-Oct-01 7:15
Jason Jystad22-Oct-01 7:15 
GeneralRe: How to age out subscribers accounts? Pin
Wanderley M22-Oct-01 7:49
Wanderley M22-Oct-01 7:49 
GeneralRe: How to age out subscribers accounts? Pin
Jason Jystad23-Oct-01 7:40
Jason Jystad23-Oct-01 7:40 

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.