ODBC for DBF / MDB, any different?
Kevin Yan -- yanlei@public.szptt.net.cn
Monday, February 12, 1996
Hi, all,
Perhaps a simple question.
I am using VC++2.0 & Win95. I want to test ODBC drivers for both Foxpro
DBF and Access MDB. Now I have one problem:
I created a simple database program using AppWizard, just open
tables from data source and display the records on form. I also created Foxpro
DBF and Access MDB files with SAME structures and changed datasource for these
two types database for testing.
The problem is: when I just open one recordset, it is OK for both types
of database; when I added another recordset/CRecordSet class in program, it only
worked for MDB, not for DBF and caused an error. Why? I have installed ODBC
drivers for both types.
But I do need develop for DBF. Anything I missed? Any help will be
appreciated.
Kevin Yan
Mike Blaszczak -- mikeblas@interserv.com
Tuesday, February 13, 1996
On Mon, 12 Feb 1996, Kevin Yan wrote:
> I am using VC++2.0 & Win95. I want to test ODBC drivers
>for both Foxpro DBF and Access MDB. Now I have one problem:
>The problem is: when I just open one recordset, it is OK
>for both types of database; when I added another recordset/CRecordSet class
>in program, it only worked for MDB, not for DBF and caused an error.
What error did it cause, exactly?
I really hate guessing games.
.B ekiM
--
TCHAR szDisc[] = _T("These words are my own; I do not speak for Microsoft.");
Kevin Yan -- yanlei@public.szptt.net.cn
Friday, February 16, 1996
The problem is like this: I want to develop application using ODBC DBase
database.
First I study the Enroll sample with VC++2.0. I created the Section and
Course database with DBase, as the same structure with StdReg.mdb, when I change
the data source and run the Enroll again, it make an error.
Then, I create two simple database tables, using both Access and DBase:
1)Section
CourseID string 10 (* key)
RoomNo string 10
Schedule string 10
2)Course
CourseID string 10 (* key)
CourseTitle string 10
I create the application like Enroll. At step 1, (only Section recordset
used), it is ok for both type of database, that mean, the Test.EXE I made can
run OK with data source with MDB, it is also OK with dataa source when I change
database to that DBF.
When I go on for step 2, adding Course as second recordset, it is Ok for
MDB, make an error for DBF. PS: I believe set the data source correctly, because
it is OK for step 1. I debug the program and find the error occors at the
code to open the second recordset:
void CSetionForm::OnInitialUpdate()
{
m_pSet = &GetDocument()->m_sectionSet;
// Fill the combo box with all of the courses
CMytestDoc* pDoc = GetDocument();
pDoc->m_courseSet.m_strSort = "CourseID";
**err here** if (!pDoc->m_courseSet.Open())
return;
.....
Any help will be greatly appreciated !
Kevin
| Вернуться в корень Архива
|