PDA

Click to See Complete Forum and Search --> : access in C++


Robbo
Oct 26th, 2001, 06:23 AM
access in C++

first of all im new to C++

i have a program in VB which does what i want but isnt compatible with all the OS

anyway what i trying to do is display an access database via C++
can any one give me some code how this can be done??

P.S the database has two tables

thanks in advance

amac
Oct 26th, 2001, 08:16 AM
It will be hard to write C++ code that will allow you to interact with an Access database across different platforms.

Because Access is a Microsoft thing... I would suggest looking into the ODBC API for Windows... but also look into the ODBC API for Linux... Both will allow you to interact with an Access DB. That will give you atleast one more platform.

I dont know much about the ODBC on Linux, but I was told the other day by a Linux "guru" that it works quite well. He said he hasn't had any problems connecting to an Access DB.

Robbo
Oct 26th, 2001, 08:23 AM
probably on win 95 but have you any code to get me started

amac
Oct 27th, 2001, 10:44 AM
well it depends on how you want to do it... MFC or API?

MFC -> take a look at CRecordset and CDatabase....

there are also classes derived from CRecordset like CDaoRecordset

API

Here is a link:
ODBC API (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/vfpodbcsupportedodbcapi.asp)

Robbo
Oct 29th, 2001, 03:02 AM
any help would be fine

the easyest way will be best at first

parksie
Oct 29th, 2001, 05:01 AM
Would it be out of line for me to recommend learning the language first before trying to do anything complicated?

Robbo
Oct 29th, 2001, 05:09 AM
maybe when ive got more time on my hands i will do a few tutorials and learn the basics for now i could do with a working program to work on and go from there, im sure the people of this domain will help me if i have any questions and help me

any real help on the subject

parksie
Oct 29th, 2001, 05:15 AM
But that's my point - you won't understand a working application if you don't know the language.

I'd suggest getting the basics together (structure, data types / sizes, pointers, arrays) and then you'll find it a lot easier rather than spinning your wheels on pointers (which I can guarantee will happen if you don't learn them first).

Robbo
Oct 29th, 2001, 05:25 AM
well at present i can create a window but need to know how i can open a ms access database and display on the form/window any ideas how to do that

CornedBee
Oct 29th, 2001, 10:20 AM
just as you do in VB I thinl - the COM interface of access databases (DAO) exists in C++ too.