Use SQL Server as database

Tested on:

All links open in new tab. Use them in case you don’t have the necessary software installed.

You might need to open Visu+ as admin: right-click on its icon and select Run as Administrator. A message box will appear asking if you allow this app to make changes to your computer. Click Yes.

Create the SQL database for your project

Open MS SQL Server Management Studio (SSMS) and connect to the installed SQL server. If you connect to the locally installed server, specify computer_name\instance_name, like below.

Right-click on Databases and select New Database. Add a meaningful name in the Database name textbox. Click OK.

Set the Default ODBC Connection Plugin

Now, go to Visu+, open your project and click on the project name, on the left side to display properties on the left side. On the General tab set the Default ODBC Connection Plugin to SQLServerExp2012.

Go to the next line, ODBC Settings, and click on the 3 dots area highlighted with blue.

In the new dialog:

  1. leave the first textbox unchanged
  2. add the SQL server in the second textbox as above
  3. enter the name of the database you created in the third textbox

Click OK to save.

Configure ODBC in Historical Log Settings

On the Project’s properties, scroll down to Historical Log Settings and expand ODBC Manager and click on ODBC DNS.  Click on the 3 dots button that just appears on the right.

Now follow the wizard. Changes/input needed are circled in red:

After you click Finish a SQL connection wizard will appear:

Next, tick the the first checkbox and put the name of the database you created for this project:

Next, no changes are needed.

On the last screen, you can test the connection. If the connection is successful, click OK to close the wizard.

Create the project’s tables

To create the project’s table you simply need to go to the last option from ODBC Manager, on the project’s properties, Create DB Table.

Warning: if you already have the tables they will be deleted and recreated – all data will be lost. Make a backup first!

Click on the 3 dots blue area.

To visualize them in SSMS, right-click the database name and select Refresh.

Sample queries for checking the data

 
 
  1. -- select a few lines (10) to see if there is data
  2. SELECT TOP 10 FROM [BMSdb].[dbo].[Alarms]
  3. -- select most recent n (10) records
  4. SELECT TOP 10 FROM [BMSdb].[dbo].[Drivers] ORDER BY [TimeCol] DESC
  5. -- select all records
  6. SELECT * FROM [BMSdb].[dbo].[SysMsgs]

 

 

2 Comments

  1. Hi,

    I’ve followed your tutorial but can’t figure out how to use the queries. Do you have a specific example of a vba script?

    Thanks,

  2. Hi Sebastien,

    The tutorial is for Visu+, it doesn’t need VBA.
    What exactly are you trying to do?

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.