Click here to Skip to main content
15,897,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Win32 project type Pin
zon_cpp29-Jan-06 23:17
zon_cpp29-Jan-06 23:17 
GeneralRe: Win32 project type Pin
Christian Graus30-Jan-06 9:15
protectorChristian Graus30-Jan-06 9:15 
QuestionRe: MDI-Opening a new document type from IDR_MAINFRAME Pin
misugi29-Jan-06 9:25
misugi29-Jan-06 9:25 
QuestionDLL crashing Pin
tansey429-Jan-06 8:48
tansey429-Jan-06 8:48 
AnswerRe: DLL crashing Pin
Stephen Hewitt29-Jan-06 11:25
Stephen Hewitt29-Jan-06 11:25 
GeneralRe: DLL crashing Pin
tansey429-Jan-06 15:33
tansey429-Jan-06 15:33 
GeneralRe: DLL crashing Pin
Stephen Hewitt29-Jan-06 15:38
Stephen Hewitt29-Jan-06 15:38 
AnswerRe: DLL crashing Pin
Prakash Nadar29-Jan-06 17:46
Prakash Nadar29-Jan-06 17:46 
General[Message Deleted] Pin
Laxman929-Jan-06 18:00
Laxman929-Jan-06 18:00 
GeneralRe: DLL crashing Pin
Prakash Nadar29-Jan-06 18:18
Prakash Nadar29-Jan-06 18:18 
GeneralRe: DLL crashing Pin
Owner drawn29-Jan-06 18:35
Owner drawn29-Jan-06 18:35 
AnswerRe: DLL crashing Pin
Laxman929-Jan-06 18:31
Laxman929-Jan-06 18:31 
QuestionF1 help annoyance Pin
Uakari29-Jan-06 3:47
Uakari29-Jan-06 3:47 
AnswerRe: F1 help annoyance Pin
Owner drawn29-Jan-06 17:03
Owner drawn29-Jan-06 17:03 
QuestionRe: F1 help annoyance Pin
Uakari29-Jan-06 22:56
Uakari29-Jan-06 22:56 
AnswerRe: F1 help annoyance Pin
Owner drawn29-Jan-06 22:58
Owner drawn29-Jan-06 22:58 
GeneralRe: F1 help annoyance Pin
Uakari29-Jan-06 23:16
Uakari29-Jan-06 23:16 
GeneralRe: F1 help annoyance Pin
Owner drawn29-Jan-06 23:31
Owner drawn29-Jan-06 23:31 
GeneralRe: F1 help annoyance Pin
Uakari30-Jan-06 1:51
Uakari30-Jan-06 1:51 
GeneralRe: F1 help annoyance Pin
Owner drawn30-Jan-06 16:54
Owner drawn30-Jan-06 16:54 
QuestionDatabase conversion using C++ Pin
SWDevil29-Jan-06 1:49
SWDevil29-Jan-06 1:49 
AnswerRe: Database conversion using C++ Pin
Eytukan29-Jan-06 3:01
Eytukan29-Jan-06 3:01 
GeneralRe: Database conversion using C++ Pin
SWDevil30-Jan-06 4:51
SWDevil30-Jan-06 4:51 
GeneralRe: Database conversion using C++ Pin
Eytukan30-Jan-06 5:28
Eytukan30-Jan-06 5:28 
GeneralRe: Database conversion using C++ Pin
SWDevil5-Feb-06 2:22
SWDevil5-Feb-06 2:22 
I wrote the following code:

CDatabase srcDb;
if (srcDb.Open(NULL))
{
m_sDbName = srcDb.GetConnect(); //m_sDbName is a variable of type CString
UpdateData(FALSE);
}

CRecordset rs(&srcDb);
CString strSQL;
strSQL = "SELECT * FROM table1";

rs.Open(CRecordset::snapshot, strSQL, CRecordset::readOnly);
rs.Close();


Everything works OK, (the database is connected), but when it gets to the row:
rs.Open(CRecordset::snapshot, strSQL, CRecordset::readOnly);
the application crashes, and I don't understand why...

Is this the right syntax for connecting to a database and retrieving data from a table? Could you maybe attach some source code, so I could compare?

Another question - after the row: rs.Open(CRecordset::snapshot, strSQL, CRecordset::readOnly); executes I should have the data from the table in the recordset object, right?





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.