Click here to Skip to main content
15,921,174 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: crash with push_back for vector Pin
Jambolo9-Feb-03 21:55
Jambolo9-Feb-03 21:55 
Generalthanks everyone!!! Pin
ns10-Feb-03 1:15
ns10-Feb-03 1:15 
Generalreading a string from a file with CFile Read() Pin
nss9-Feb-03 6:40
nss9-Feb-03 6:40 
GeneralRe: reading a string from a file with CFile Read() Pin
Chris Losinger9-Feb-03 7:12
professionalChris Losinger9-Feb-03 7:12 
GeneralThank you!!!!! Pin
nss9-Feb-03 8:19
nss9-Feb-03 8:19 
GeneralCalling functions in DLL Pin
hongheo769-Feb-03 5:24
hongheo769-Feb-03 5:24 
GeneralRe: Calling functions in DLL Pin
Roman Nurik9-Feb-03 5:29
Roman Nurik9-Feb-03 5:29 
GeneralSIMPLE db example Pin
JockeP9-Feb-03 4:58
JockeP9-Feb-03 4:58 
Hi!

I have tried to find a simple way to manipulate a database (in MS Access or MS SQL Server). However, I've not succeeded. I've tried SELECT statements with CRecordset and it works. But it seems like only SELECT statements work. This is what I've tried:

CDaoDatabase* m_pDB;
CDaoRecordset* m_pRS;
m_pDB = new CDaoDatabase;
m_pRS = new CDaoRecordset(m_pDB);

try {
m_pDB->Open("c:\\accessdb\\db1.mdb");
// CString strQuery = _T("SELECT * FROM Table1"); //Works just fine...
CString strQuery = _T("INSERT INTO Table1 VALUES ('3', 'Olga')"); //Doesn't work
m_pRS->Open(dbOpenDynaset, strQuery);
} catch (CDaoException* e) {
AfxMessageBox(e->m_pErrorInfo->m_strDescription);
e->Delete();
}

So how do you add data to a table, modify tables and so on?

Cheers,
Joachim
GeneralRe: SIMPLE db example Pin
l a u r e n9-Feb-03 7:15
l a u r e n9-Feb-03 7:15 
GeneralRe: SIMPLE db example Pin
Anonymous9-Feb-03 7:17
Anonymous9-Feb-03 7:17 
GeneralRe: SIMPLE db example Pin
l a u r e n9-Feb-03 7:21
l a u r e n9-Feb-03 7:21 
GeneralRe: SIMPLE db example Pin
JockeP9-Feb-03 10:59
JockeP9-Feb-03 10:59 
GeneralRe: SIMPLE db example Pin
Michael P Butler9-Feb-03 11:21
Michael P Butler9-Feb-03 11:21 
GeneralRe: SIMPLE db example Pin
bryce9-Feb-03 15:30
bryce9-Feb-03 15:30 
GeneralRe: SIMPLE db example Pin
Solomon Wu9-Feb-03 18:22
Solomon Wu9-Feb-03 18:22 
GeneralC++ template class and CDialog Pin
Moak9-Feb-03 4:13
Moak9-Feb-03 4:13 
GeneralRe: C++ template class and CDialog Pin
Joaquín M López Muñoz9-Feb-03 4:57
Joaquín M López Muñoz9-Feb-03 4:57 
GeneralRe: C++ template class and CDialog Pin
Moak9-Feb-03 12:08
Moak9-Feb-03 12:08 
QuestionOpenGL or DirectX ? Pin
Alex H 19839-Feb-03 3:51
Alex H 19839-Feb-03 3:51 
AnswerRe: OpenGL or DirectX ? Pin
Moak9-Feb-03 4:05
Moak9-Feb-03 4:05 
AnswerRe: OpenGL or DirectX ? Pin
Mike Nordell9-Feb-03 15:03
Mike Nordell9-Feb-03 15:03 
GeneralQuestion about printf("%ld", ...) Pin
George29-Feb-03 1:05
George29-Feb-03 1:05 
GeneralRe: Question about printf("%ld", ...) Pin
Tim Smith9-Feb-03 1:25
Tim Smith9-Feb-03 1:25 
GeneralRe: Question about printf("%ld", ...) Pin
George29-Feb-03 1:35
George29-Feb-03 1:35 
GeneralRe: Question about printf("%ld", ...) Pin
Gary R. Wheeler9-Feb-03 5:00
Gary R. Wheeler9-Feb-03 5:00 

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.