03-08-2018 01:23 PM
I want to create a labview program that uses the db connectivity toolkit to insert data into an access db. I then want to create an installer and insert the db in the installer so that I can install this app on multiple computers.
From what I have seen on the internet, I have to connect to the db using an address on my machine, but I want to know if its possible to do this with an address that can change among machines.
If this is possible, can someone please tell me how to do this?
Some instructions will be greatly appreciated.
Thanks.
03-08-2018 01:36 PM
Does it have to be Access? Microsoft has an express version of SQL that is free to use, can be installed on a server and is generally an all-around better dB. I'm not sure if Access can be used on a network as easily.
03-08-2018 01:40 PM
I don't want to install it on a server, but rather distribute my app to other pcs. the db wont be the same but the app and the db structure will.
I don't know if I can use a relative path to the access db?
Thanks.
03-08-2018 01:44 PM
So each application is writing to it's only local version of the dB. You can store the db file in the same directory as the exe (or in the Data folder) and writing to it should be very simple. You'll need to create a connection string but that can be generated dynamically within your code. You should always avoid hard-coding paths to files and folders.
03-08-2018 01:46 PM
That's exctly what I want, but don't know how.
Could you please let me know which steps could I take to do this?
Thanks.
03-08-2018 01:49 PM - edited 03-08-2018 01:50 PM
https://www.connectionstrings.com/access/
You'll have to find one that works with the driver that you are using. You'll notice that each connection string has a path to the dB. This is the part that you'll generate dynamically in your code, based on the location of your EXE file.
03-08-2018 04:26 PM
I was also thinking about using application directory to reference the access db, but I don't know how to use an access db, so I would really wish you could guide me.
Could you please help me?
Thanks in advance.
03-08-2018 04:32 PM
I assume you have the Database Connectivity Toolkit. If so, this is what you need to execute queries into your database. There are examples that ship with Labview that can show you how to do this.
If your question is about how to setup an Access dB, creating the various tables and columns, you're on the wrong website. Google is going to be your friend here. You should be able to find lots of Access tutorials online.
03-08-2018 04:55 PM
My question is on how to use the db connectivity toolkit to connect to an access db with a relative path.
I have used the connectivity db, but just once and it was a long time ago, so I don't remember on how to use it, and I've never used it with access.
Can you please help me?
Thanks.
03-08-2018 05:10 PM
There are several ways to do it. Here is one way, using the DB Tools Insert Data VI. I picked a random connection string from the website and built a path dynamically to the mdb file. As I said, you'll need to use a connection string that is compatible with the installed driver.