LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect to MS Access in CVI without using the SQL toolkit?

Hi,
 
How can I make a simple query to a MS Access database in CVI without using the SQL toolkit for CVI?
 
Thanks,
 
Delfino
0 Kudos
Message 1 of 6
(7,409 Views)
Hello

If you have installed the Windows SDK, you can use the ODBC functions to access a database. But it is not so simple, i guess...
measX GmbH
www.measx.com
Message 2 of 6
(7,400 Views)

Delfino,

As stephan said, it is not a simple thing to use ODBC if you are new to either C or to databases in general.  Mostly because ODBC is so old there is not too much reference matrial.  However, once you get some experience you will find it is a very robust way to communicate with databases, and you then can create your own DLL's to simulate the NI functionality.   If you are new to C or DB's or have never heard of ODBC before, plan on spending a non-trivial amount of time to get to a point where you can get data from a database.

The following link should help to get you started on your quest... 

http://www.codeproject.com/database/sqlconnect.asp

 The data in the aforementioned link is nominally for using ODBC with SQL Server, but the only difference implementation wise you will see between the two is that you have to use a different connection strings (which is why ODBC rocks!).  The following link will provide you with all of the connection stings that you will need.

http://www.simongibson.com/intranet/adoodbc/

The last link here is a good overview of ODBC from MSDN.  You will probably need to upgrade your machine (and any other machine you plan on developing ODBC with) with the MDAC 2.8 kit or whatever version it is at now, but once you create a .DLL with your ODBC functions you can just use that and won't have to worry about the extra source files that are needed for developing with ODBC and are included in the current MDAC kit.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcabout_this_manual.asp

Message Edited by DaveC on 03-03-2006 09:32 AM

Message 3 of 6
(7,386 Views)

Thanks to both of you Dave and Stephan,

Before I saw your reply I wrote already some code using the MS Access ActiveX controller generated by the CVI wizard. And is working now! Just for future reference the general procedure using activeX was: create a new Access instance, then open the database, create a form, specify the query to the form, insert some controls to the form, display the form and then send query result to a text file.

Thanks again,

Delfino

0 Kudos
Message 4 of 6
(7,375 Views)
Hey Dave,
 
What if you don't have a sequel server, can you still use your sql server code?  Also, I heard that you can use the activeX library to create an ms activeX server.  I basically want to open a data base, and then write a record.  I don't need to do any queries.  Any ideas?
 
Thanks,
 
Zot
0 Kudos
Message 5 of 6
(7,195 Views)

Hey DSandoval,

Care to expound on how you were able to open a ms database, and write to a table by creating and using an activeX server?

Thanks,

Zot

0 Kudos
Message 6 of 6
(7,160 Views)