Question

I've created a new database using Microsoft SQL Server Management Studio, and now I want to interact with it through LabVIEW. I already have several VIs to interact with a previous database, using the database connectivity tool kit. This database was created by someone who has since left the project and I can't find it in anything but LabVIEW. I'm quite experienced with LabVIEW, but completely new to and bewildered by databases.

Thank you in advance.

Was it helpful?

Solution

The first Connectivity Toolkit VI called should be Open Connection.

The existing code (VI) will either use a file or a string as an input.

If the input is a string, then you will need to create a new connection string compatible with your server. You can find common SQL Server strings at https://www.connectionstrings.com/sql-server-2008/

If the input is a file name, you can copy the .UDL file that is referenced and then modify the copied file by opening it (double click) and then select the OLE DB Provider for SQL Server and then set the connection options to point to your server, database etc. and then test the connection.

OTHER TIPS

Basically the workflow you have to go through is the following:

  • Open connection
  • Execute your query
  • Fetch data (if needed)
  • Close connection

If you search for "Database" in the NI Example Finder shipped with Labview you will find a few good starting points.

In particular give a look to Database Connection.vi and Database Fetching.vi. If you plan to use transactions try also Database Transaction.vi.

I found that the solution to my problem was to create a .udl file and use that as the file path for opening the database connection.

Here's the address that taught me how to do this: http://msdn.microsoft.com/en-us/library/e38h511e(v=vs.71).aspx

Thank you to everyone who submitted answers, they certainly helped point me in the right direction.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top