Click here to Skip to main content
16,007,760 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMultiple Computers accessing the same file Pin
Joshua Lunsford28-Dec-05 8:48
Joshua Lunsford28-Dec-05 8:48 
AnswerRe: Multiple Computers accessing the same file Pin
David Crow28-Dec-05 9:44
David Crow28-Dec-05 9:44 
GeneralRe: Multiple Computers accessing the same file Pin
JstDaNuGuy28-Dec-05 9:58
JstDaNuGuy28-Dec-05 9:58 
GeneralRe: Multiple Computers accessing the same file ( edit) Pin
Maximilien28-Dec-05 10:05
Maximilien28-Dec-05 10:05 
Questionmaintaining a logfile Pin
RabiaAslam28-Dec-05 6:50
RabiaAslam28-Dec-05 6:50 
AnswerRe: maintaining a logfile Pin
Maximilien28-Dec-05 7:53
Maximilien28-Dec-05 7:53 
QuestionMFC MDI : StartUp Child like Macromedia Pin
BrownJacket28-Dec-05 6:43
BrownJacket28-Dec-05 6:43 
QuestionCRecordset update Pin
pnpfriend28-Dec-05 6:05
pnpfriend28-Dec-05 6:05 
Hi all,
I'm using Edit() and Update() functions to update the fields in the table. However, at particular (always) record, I got error exception which can't catch with CDBException or CException. So I used catch(...) to catch any exception. Then used sqlcomman to update the field. That particular record, let's say recnum=600,
exception got thrown, caught it by using catch(...), the field2 of recnum=600 got updated executing sql command "UPDATE ... SET". But got exception at the next following record,which is in this example, recnum=601, and got another CDBException after calling SQL command, . Error is saying "connection to DB got lost".

Why??
Why can't always at some particular record cant' update and throwing exception that can't catch with neither CDBException nor CException.
Why after that particular record get updated with SQL command, the next record can't update by using Edit() and Update() or ExecuteSQL()?


my code looks like this
<br />
while(!rs.IsEOF())<br />
{<br />
  if(recnum==600 || recnum==953 ) // and some other records<br />
    rs.MoveNext();<br />
 rs.Edit();<br />
rs.field2 = newdata;<br />
rs.Update();<br />
  <br />
}<br />
catch(...) //catch(CDBException *per) // catch(CException *err)<br />
{<br />
 CString qstr;<br />
qstr.Format("Update %s set field2=%d where recnum=%d",tablename,newdata,recnum);<br />
rs.m_pDatabase->ExecuteSQL(qstr);<br />
}<br />
<br />

QuestionRe: CRecordset update Pin
David Crow28-Dec-05 9:57
David Crow28-Dec-05 9:57 
AnswerRe: CRecordset update Pin
pnpfriend28-Dec-05 12:15
pnpfriend28-Dec-05 12:15 
AnswerRe: CRecordset update Pin
pnpfriend10-Jan-06 7:56
pnpfriend10-Jan-06 7:56 
QuestionRe: CRecordset update Pin
David Crow10-Jan-06 7:59
David Crow10-Jan-06 7:59 
QuestionLooking for code to learn from. Pin
dbough28-Dec-05 4:51
dbough28-Dec-05 4:51 
AnswerRe: Looking for code to learn from. Pin
David Crow28-Dec-05 5:33
David Crow28-Dec-05 5:33 
AnswerRe: Looking for code to learn from. Pin
Prakash Nadar28-Dec-05 5:42
Prakash Nadar28-Dec-05 5:42 
AnswerRe: Looking for code to learn from. Pin
Bob Stanneveld28-Dec-05 5:54
Bob Stanneveld28-Dec-05 5:54 
GeneralRe: Looking for code to learn from. Pin
John R. Shaw28-Dec-05 16:06
John R. Shaw28-Dec-05 16:06 
GeneralRe: Looking for code to learn from. Pin
Bob Stanneveld29-Dec-05 6:11
Bob Stanneveld29-Dec-05 6:11 
AnswerRe: Looking for code to learn from. Pin
Gary R. Wheeler28-Dec-05 6:00
Gary R. Wheeler28-Dec-05 6:00 
AnswerRe: Looking for code to learn from. Pin
dbough28-Dec-05 6:41
dbough28-Dec-05 6:41 
GeneralRe: Looking for code to learn from. Pin
John R. Shaw28-Dec-05 16:52
John R. Shaw28-Dec-05 16:52 
QuestionGet flicker free image Pin
sam o neil28-Dec-05 4:26
sam o neil28-Dec-05 4:26 
AnswerRe: Get flicker free image Pin
John R. Shaw28-Dec-05 17:05
John R. Shaw28-Dec-05 17:05 
Questionmaintain logfile of the accessed files Pin
RabiaAslam28-Dec-05 3:09
RabiaAslam28-Dec-05 3:09 
AnswerRe: maintain logfile of the accessed files Pin
vipinasda28-Dec-05 3:41
vipinasda28-Dec-05 3:41 

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.