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

C / C++ / MFC

 
GeneralVanished Hotkeys Pin
4-Apr-01 5:39
suss4-Apr-01 5:39 
GeneralRe: Vanished Hotkeys Pin
Jim A. Johnson4-Apr-01 6:23
Jim A. Johnson4-Apr-01 6:23 
GeneralRe: Vanished Hotkeys Pin
Peter Pearson6-Apr-01 0:15
Peter Pearson6-Apr-01 0:15 
GeneralSTL: How can I delete a <list>... Pin
Braulio Dez4-Apr-01 5:28
Braulio Dez4-Apr-01 5:28 
GeneralRe: STL: How can I delete a <list>... Pin
MikeG5-Apr-01 1:19
MikeG5-Apr-01 1:19 
GeneralHide classes from ClassView Pin
Luis Barreira4-Apr-01 5:27
Luis Barreira4-Apr-01 5:27 
GeneralRe: Hide classes from ClassView Pin
Erik Funkenbusch4-Apr-01 8:45
Erik Funkenbusch4-Apr-01 8:45 
GeneralInitialize MFC-ODBC app from query Pin
Robert Bushlow4-Apr-01 4:49
Robert Bushlow4-Apr-01 4:49 
I currently have an MFC-ODBC based application with
the wizard generated initialization. I would like
to initialize from a SELECT FROM WHERE type query.
My current code as follows:


CRegiDBSet::CRegiDBSet(CDatabase* pdb)
: CRecordset(pdb)
{
//{{AFX_FIELD_INIT(CRegiDBSet)
m_CourseID = _T("");
m_CourseTitle = _T("");
m_Hours = 0;
m_StudentID = 0;
m_CourseID2 = _T("");
m_SectionNo = _T("");
m_Grade = _T("");
m_InstructorID = _T("");
m_Name = _T("");
m_RoomNo = _T("");
m_CourseID3 = _T("");
m_SectionNo2 = _T("");
m_InstructorID2 = _T("");
m_RoomNo2 = _T("");
m_Schedule = _T("");
m_Capacity = 0;
m_StudentID2 = 0;
m_Name2 = _T("");
m_GradYear = 0;
m_nFields = 19;
//}}AFX_FIELD_INIT
m_nDefaultType = snapshot;
}

CString CRegiDBSet::GetDefaultConnect()
{
return _T("ODBC;DSN=Student Registration");
}

CString CRegiDBSet::GetDefaultSQL()
{
return _T("[Course],[Enrollment],[Instructor],[Section],[Student]");
}


This brings in all of the rows from all of the tables.
I would like to initialize from a select; something like the following.
I have already tried substituting this in the GetDefaultSQL proc.


_T("
SELECT Course.CourseID as 'ID',
Course.CourseTitle as 'Title',
Section.Hours as 'Hours',
Section.RoomNo as 'Room',
Instructor.m_InstructorID
FROM Course, Enrollment, Instructor, Section, Student
WHERE Course.CourseTitle like 'Math'
ORDER BY 'ID', 'Room'
");



Additionally the wizard generates a large list of variables
corresponding to all of the columns in the tables. I would
like to initialize my date with the results from the query
shown above. Working example code would be very helpful.
Thank You.


GeneralCCheckBox buttons Pin
Roger4-Apr-01 4:27
Roger4-Apr-01 4:27 
GeneralRemove Read Only flag ? (no MFC ) Pin
Christian Graus4-Apr-01 1:57
protectorChristian Graus4-Apr-01 1:57 
GeneralRe: Remove Read Only flag ? (no MFC ) Pin
4-Apr-01 3:37
suss4-Apr-01 3:37 
Questionhow to construct a OLE DB framework in regular DLL? Pin
3-Apr-01 22:21
suss3-Apr-01 22:21 
QuestionCustom Appwizard to create no MFC? Pin
3-Apr-01 20:18
suss3-Apr-01 20:18 
AnswerRe: Custom Appwizard to create no MFC? Pin
Michael Dunn3-Apr-01 22:04
sitebuilderMichael Dunn3-Apr-01 22:04 
General? Strange print behaviour Pin
Richard Ellis3-Apr-01 19:07
Richard Ellis3-Apr-01 19:07 
QuestionHow to block win98 explorer.exe when win98 startup ? Pin
Hong Bob3-Apr-01 18:31
Hong Bob3-Apr-01 18:31 
QuestionHow to block win98 explorer.exe when win98 startup ? Pin
Hong Bob3-Apr-01 18:31
Hong Bob3-Apr-01 18:31 
QuestionHow Save a CListCtrl Pin
BLaZe3-Apr-01 17:40
BLaZe3-Apr-01 17:40 
AnswerRe: How Save a CListCtrl Pin
Robert Bushlow4-Apr-01 12:48
Robert Bushlow4-Apr-01 12:48 
GeneralRe: How Save a CListCtrl Pin
BLaZe8-Apr-01 18:15
BLaZe8-Apr-01 18:15 
Generaldeveloping a ms-paint like application Pin
mayank3-Apr-01 17:16
mayank3-Apr-01 17:16 
GeneralRe: developing a ms-paint like application Pin
Christian Graus3-Apr-01 18:12
protectorChristian Graus3-Apr-01 18:12 
GeneralCString::ReleaseBuffer() Pin
3-Apr-01 16:52
suss3-Apr-01 16:52 
GeneralRe: CString::ReleaseBuffer() Pin
Michael Dunn3-Apr-01 18:39
sitebuilderMichael Dunn3-Apr-01 18:39 
GeneralRe: CString::ReleaseBuffer() Pin
Kannan Kalyanaraman3-Apr-01 20:44
Kannan Kalyanaraman3-Apr-01 20:44 

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.