SQL and Visual C++
-
hello @all, i have an mfc program and an access database. i connected them with odbc. how can i make the following sql statement in my mfc programm? 'select distinct xy from mytable' thank you very much. mfc
-
hello @all, i have an mfc program and an access database. i connected them with odbc. how can i make the following sql statement in my mfc programm? 'select distinct xy from mytable' thank you very much. mfc
:cool:Use CRecordset Open() member function.
-
:cool:Use CRecordset Open() member function.
thanks for reply, but it does not work. somewhere i make a mistake. i want to read out 'xy' from a table 'mytable' and put these CString into a ComboBox: Now i tried this:
CMyDatabase db; db.Open( CRecordset::dynaset, _T( "Select distinct xy from mytable" ) ); db.MoveFirst(); while(!db.IsEOF()) { m_ctrlCombo.AddString(db.m_xy); db.MoveNext(); } db.Close(); UpdateData(false);
i get the error, when i want to use this funktion. the error: error with the call of a data record thanks mfc -
thanks for reply, but it does not work. somewhere i make a mistake. i want to read out 'xy' from a table 'mytable' and put these CString into a ComboBox: Now i tried this:
CMyDatabase db; db.Open( CRecordset::dynaset, _T( "Select distinct xy from mytable" ) ); db.MoveFirst(); while(!db.IsEOF()) { m_ctrlCombo.AddString(db.m_xy); db.MoveNext(); } db.Close(); UpdateData(false);
i get the error, when i want to use this funktion. the error: error with the call of a data record thanks mfc:) you can use some SQL tools(such SQL Server's Query Analyzer) which can chech you SQL statement, go, if you SQL statement is right that you can see the result for you query. My English is not good, but I can try my best for your problem.:cool: hi