ODBC create table question
Kevin O'Malley -- omalley@umich.edu
Tuesday, March 05, 1996
I am writing a program using MFC and ODBC that reads a text file,
connects to a data source (in this case MS-Access), creates a new table,
and writes the data read from the text file to the new table. How do I
create and write to a new table using ODBC?
Thanks
(This is my first ODBC program so any pointers to information would be
great)
--
Kevin O'Malley
Programmer/Analyst II
Transportation Research Institute
University of Michigan (UMTRI)
omalley@umich.edu
Chia Teck Chin Joseph -- chiateck@iscs.nus.sg
Wednesday, March 06, 1996
[Moderator's note: Sorry about this one, folks. I wasn't paying
attention.]
> I am writing a program using MFC and ODBC that reads a text file,
> connects to a data source (in this case MS-Access), creates a new table,
> and writes the data read from the text file to the new table. How do I
> create and write to a new table using ODBC?
>
> Thanks
>
> (This is my first ODBC program so any pointers to information would be
> great)
>
Well, you could just issue an SQL statement like
"create table Table1 (id integer, name char, . . . )"
And then insert the tuples like
"insert into Table1 values(34,'johan', . . .)"
you may use either SQLExec or SQLExecDirect to perform the above
statements.
Of course, you can also create a key for Table1 or whatever the name
of your table is. Just do something like
"create unique index (id ASC)"
Glad to be of help :)
- Joseph
| Вернуться в корень Архива
|