ODBC Problem again...
Mihir Dalal -- m_dalal@ECE.concordia.CA
Monday, March 03, 1997
Environment: MSVC 1.52, Windows 95, dBase III
Hi,
I need to create tables at run time from a menu handler in my SDI
complaint, database enabled application.
Accordingly, I prepared & executed the following SQL statement in
my menu handler:
"CREATE TABLE [NewDB] (Field1, Field2,.......)";
Thats fine, but now I need to set one of the fields as the primary key to
the Database table.
For that I need to prepare & execute
"CREATE TABLE [NewDB] (Field1, Field2 PRIMARY KEY,.......)";
The "PRIMARY KEY" as I understand is valid in SQL Grammer. The ODBC API
promises to support all of the SQL grammer, then why does
SQLPrepare() fail on this particular statement ??
Any answer or alternative to this ???
Mihir.
_________________________________________________________________________
Mihir Dalal , M.Engg. (Electrical) Student
Department of Electrical and Computer Engineering
Concordia University, Montreal, Canada
http://www.ECE.Concordia.CA/~m_dalal/addr.html
Brian Welsh -- brianw@mail1.i1.net
Wednesday, March 05, 1997
Hello -
It has been a long time since I had to deal with dBase files, but,
I'll take a stab at it...
1) What is the error being returned to you? Check the error returned
by SQLPrepare(), this could be very revealing.
> "CREATE TABLE [NewDB] (Field1, Field2 PRIMARY KEY,.......)";
2) Although I cannot test the theory, it seems to me the reason this
fails is that dBase does not have the concept of "PRIMARY KEY" only
indexes.
3) Try preparing a second SQL using "CREATE INDEX". This may create
the desired results.
Side note:
It seems to me I read something at one time about ODBC and/or the ISAM
drivers not using indexes even when they do exist. In other words,
all lookups are done sequentially. I can't remember where or when I
saw this, maybe someone else on the list knows.
Good Luck
Brian Welsh
----------------------------------
brianw@i1.net
http://www.i1.net/~brianw
----------------------------------
> Date: Mon, 3 Mar 1997 23:57:55 -0500 (EST)
> From: Mihir Dalal
> To: mfc-l@netcom.com
> Subject: ODBC Problem again...
> Reply-to: mfc-l@netcom.com
>
>
>
> Environment: MSVC 1.52, Windows 95, dBase III
>
> Hi,
>
> I need to create tables at run time from a menu handler in my SDI
> complaint, database enabled application.
>
> Accordingly, I prepared & executed the following SQL statement in
> my menu handler:
>
>
> "CREATE TABLE [NewDB] (Field1, Field2,.......)";
>
> Thats fine, but now I need to set one of the fields as the primary key to
> the Database table.
>
> For that I need to prepare & execute
>
> "CREATE TABLE [NewDB] (Field1, Field2 PRIMARY KEY,.......)";
>
> The "PRIMARY KEY" as I understand is valid in SQL Grammer. The ODBC API
> promises to support all of the SQL grammer, then why does
>
> SQLPrepare() fail on this particular statement ??
>
> Any answer or alternative to this ???
>
> Mihir.
>
>
> _________________________________________________________________________
> Mihir Dalal , M.Engg. (Electrical) Student
> Department of Electrical and Computer Engineering
> Concordia University, Montreal, Canada
> http://www.ECE.Concordia.CA/~m_dalal/addr.html
>
>
>
>
>
Become an MFC-L member
| Вернуться в корень Архива
|