Basic ODBC Database Query 
Author Message
 Basic ODBC Database Query

Can anyone show me how to do the following in C with a short example
program?

1. Establish an ODBC database connection.
2. Submit a standard SQL query.
3. Loop through the resulting cursor and access fields.
4. Close the connection.

Also, will the code differ appreciably for Windows and Unix ?

Thanks,

Mike Fasano



Sat, 02 Jun 2001 03:00:00 GMT  
 Basic ODBC Database Query

Quote:

> Can anyone show me how to do the following in C with a short example
> program?

"Short" and "C ODBC Example Program" are mutually exclusive.
Using the ODBC API in C is like building a cathedral out
of matchsticks. It's all low-level bite-sized pieces.

Quote:
> Also, will the code differ appreciably for Windows and Unix ?

You betcha. The first difference is ODBC isn't easy to get
on UNIX! :)

Scott



Sat, 02 Jun 2001 03:00:00 GMT  
 Basic ODBC Database Query
Hi Mike!

 MF> Can anyone show me how to do the following in C with a short
 MF> example program?

 MF> 1. Establish an ODBC database connection.
 MF> 2. Submit a standard SQL query.
 MF> 3. Loop through the resulting cursor and access fields.
 MF> 4. Close the connection.
1st you have to read the ODBC Online-Documentation of M$ there are much
examples in there and understand them.

I can Help if you fall in trouble. Also I'm able to answer your questions. But
the first step is to try yourself ;-)

Or you may ask me to create a program for you but this is a contract which
costs about 50 US$/hour for you. If I have spare time ;-)

 MF> Also, will the code differ appreciably for Windows and Unix ?
AFAIK the doesn't exist ODBC for Unix, but I'm not sure.

BTW: This is not the right newsgroup for such specialized questions.
     about M$ software.
     There is also existing a good book about ODBC ("Inside ODBC...")
     M$ Press, sorry no ISBN if you need it then write an e-mail to me
     (personal).


'til next mail.        Internet: http://www.fido.de/~kama/
  Karl Heinz 7:-)       Fidonet: 2:2452/110.18
                          Voice: +49 241 962380



Sun, 03 Jun 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Query: Are the below databases ODBC Compliant ?

2. Querying a database by using MFC ODBC and MSQL 6.5

3. How do you access remote databases where the database is not registed in the local ODBC

4. A Basic MFC Linking Query

5. ODBC Error : "Query is too complex"

6. ODBC Error: Operation must use an updatable query.

7. Calling a Query in MSAccess from ODBC?

8. Select query on LongBinary data types, MFC ODBC

9. DAO/ODBC multi-query ?

10. ODBC - LIKE command in the definition of a query

11. ODBC Query Timeout Values

12. problem querying excel file tables via odbc

 

 
Powered by phpBB® Forum Software