Click here to Skip to main content
15,912,507 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralListBox problem ... Pin
Hadi Rezaee22-Feb-01 0:56
Hadi Rezaee22-Feb-01 0:56 
GeneralListCtrl Scrolling Pin
banrio21-Feb-01 23:55
banrio21-Feb-01 23:55 
GeneralResource ID for dynamically created component Pin
nicola21-Feb-01 22:42
nicola21-Feb-01 22:42 
GeneralRe: Resource ID for dynamically created component Pin
l a u r e n22-Feb-01 6:09
l a u r e n22-Feb-01 6:09 
GeneralRe: Resource ID for dynamically created component Pin
Erik Funkenbusch22-Feb-01 12:54
Erik Funkenbusch22-Feb-01 12:54 
QuestionHow to get ip and customer id again!!! Pin
21-Feb-01 21:48
suss21-Feb-01 21:48 
AnswerRe: How to get ip and customer id again!!! Pin
Le Ridder Noir21-Feb-01 22:01
Le Ridder Noir21-Feb-01 22:01 
GeneralDataBase and ATL Pin
ov21-Feb-01 21:42
ov21-Feb-01 21:42 
I'm using CDataSource, CSession etc to work with some database.
This database is having, for example, one table with two columns.
One is a self-incrementing counter (index) and other is a value.
My task is to write a function like this:
long Add(long val) {
   // bla-bla-bla
   return index_of_val_added;
}

I'm doing it this way:
long Add(long val) {
   CCommand< CAccessor< table > > t;
   t.Open(session, "insert into table(val) values(-1);", NULL, NULL, DBGUID_DEFAULT, FALSE);
   t.Close();
   t.Open(session, "select * from table where val=-1;");
   int id = t.m_id; // got it
   t.Close();
   CString s;
   s.Format("update table set val=%d where id=%d", val, id);
   t.Open(session, s, NULL, NULL, DBGUID_DEFAULT, FALSE);
   t.Close();
   return id;
}


I know, that it is ugly... Could anybody show me the correct way to do it?

With the best regards, Vitaly.
GeneraliJpeg Image Pin
21-Feb-01 21:38
suss21-Feb-01 21:38 
GeneralRe: iJpeg Image Pin
22-Feb-01 1:46
suss22-Feb-01 1:46 
GeneralHELP! User-defined Msg caused illegal operation at run time Pin
21-Feb-01 19:23
suss21-Feb-01 19:23 
GeneralRe: HELP! User-defined Msg caused illegal operation at run time Pin
Tim Deveaux22-Feb-01 3:45
Tim Deveaux22-Feb-01 3:45 
GeneralWinsock & SOCKS Pin
Amit Jain21-Feb-01 16:28
Amit Jain21-Feb-01 16:28 
QuestionC++ equivalent of C getch()? Pin
21-Feb-01 15:41
suss21-Feb-01 15:41 
AnswerRe: C++ equivalent of C getch()? Pin
Amit Jain21-Feb-01 16:39
Amit Jain21-Feb-01 16:39 
GeneralRe: C++ equivalent of C getch()? Pin
Christian Graus21-Feb-01 17:35
protectorChristian Graus21-Feb-01 17:35 
GeneralRecord Headers in ListBox and retrival Pin
Ariel21-Feb-01 14:21
Ariel21-Feb-01 14:21 
GeneralTrying to Lock some Records in ODBC - CRecordset Pin
Ariel21-Feb-01 14:13
Ariel21-Feb-01 14:13 
Generalplease...please... Pin
hahyojin21-Feb-01 13:24
hahyojin21-Feb-01 13:24 
GeneralRe: please...please... Pin
Le Ridder Noir21-Feb-01 22:03
Le Ridder Noir21-Feb-01 22:03 
GeneralRe: I know...&#12640;&#12640; Pin
21-Feb-01 22:09
suss21-Feb-01 22:09 
GeneralUpdate an array of strings in a DLL Pin
21-Feb-01 11:57
suss21-Feb-01 11:57 
GeneralRe: Update an array of strings in a DLL Pin
Julien22-Feb-01 16:22
Julien22-Feb-01 16:22 
GeneralRe: Update an array of strings in a DLL Pin
23-Feb-01 3:08
suss23-Feb-01 3:08 
GeneralCEdit::GetLine HELP!!! Pin
Antonio21-Feb-01 11:30
Antonio21-Feb-01 11:30 

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.