• No results found

15 5 SQL Toolkit SQL Toolkit

In document Database Communication in LabVIEW (Page 74-81)

15 5 SQL Toolkit SQL Toolkit

I have made a simple and easy to-use SQL Toolkit. The SQL Toolkit is available for download from my I have made a simple and easy to-use SQL Toolkit. The SQL Toolkit is available for download from my Blog:

Blog: http://home.hit.no/~hansha/http://home.hit.no/~hansha/

15.1

15.1 Installation Installation

The installation procedure is as follows:

The installation procedure is as follows:

1.

1. Download the zip file SQLToolkit.zip from my BlogDownload the zip file SQLToolkit.zip from my Blog 2.

2. Unzip the fileUnzip the file 3.

3. Copy "SQLToolkit.mnu" to ...\LabVIEW 2009Copy "SQLToolkit.mnu" to ...\LabVIEW 2009 \menus\Categories\\menus\Categories\

4.

4. Copy "SQLToolkit.llb" to ...\LabVIEW 2009\vi.lib\Copy "SQLToolkit.llb" to ...\LabVIEW 2009\vi.lib\

5.

5. The SQL Toolkit is ready to use and in the Functions palette in LabVIEW a new palette namedThe SQL Toolkit is ready to use and in the Functions palette in LabVIEW a new palette named

"SQL" will appear.

"SQL" will appear.

The SQL Toolkit palette in available in LabVIEW:

The SQL Toolkit palette in available in LabVIEW:

The SQL Toolkit contains the following VIs:

The SQL Toolkit contains the following VIs:

““SQL Open.viSQL Open.vi”” - This VI open a connection to the database specified in the Connection string. - This VI open a connection to the database specified in the Connection string.

The connection string may be as follows:

The connection string may be as follows:

“PROVIDER=SQLOLEDB; DATA SOURCE=xxx;UID=xxx;PWD=xxx;DATABASE=

“PROVIDER=SQLOLEDB; DATA SOURCE=xxx;UID=xxx;PWD=xxx;DATABASE=xxxxxx

You need to replace the “xxx

You need to replace the “xxx” with the parameters from you” with the parameters from your database.r database.

““SQL Select.viSQL Select.vi”” -This VI get data from the database specified in the SQL Query. The output is a -This VI get data from the database specified in the SQL Query. The output is a 2D string array with data.

2D string array with data.

69

69 SQL SQL ToolkitToolkit

Tutorial: Database Communication in LabVIEW Tutorial: Database Communication in LabVIEW

““SQL Execute.viSQL Execute.vi”” - This VI executes a Query with no return Data, e.g., an INSERT statement - This VI executes a Query with no return Data, e.g., an INSERT statement

““SQL Close.viSQL Close.vi”” - This VI Close the connection to the database opened by "SQL Open.vi" - This VI Close the connection to the database opened by "SQL Open.vi"

Two examples are also included:

Two examples are also included:

““SQLSQL – – Example 1.vi Example 1.vi”” – – This example selects data from a table. This example selects data from a table. The example uses “SQLThe example uses “SQL Select.vi” in order to get data from the database.

Select.vi” in order to get data from the database.

Front panel:

Front panel:

Block Diagram:

Block Diagram:

““SQLSQL – – Example 2.vi Example 2.vi”” – – This example inserts data into a table. This example inserts data into a table. The example uses “SQLThe example uses “SQL Execute.vi” in order to insert data into the database. No data is returned.

Execute.vi” in order to insert data into the database. No data is returned.

Front panel:

Front panel:

70

70 SQL SQL ToolkitToolkit

Tutorial: Database Communication in LabVIEW Tutorial: Database Communication in LabVIEW

Block Diagram:

Block Diagram:

Example: Get Data into LabVIEW using SQL Toolkit Example: Get Data into LabVIEW using SQL Toolkit Download the SQL toolkit from the

Download the SQL toolkit from the Homepage of the Database LabHomepage of the Database Laband follow the instructions in theand follow the instructions in the ReadMe file.

ReadMe file.

On the Functions palette on your Block Diagram the following

On the Functions palette on your Block Diagram the following palette should appear:palette should appear:

Here is a simple example of how you get data from the database into LabVIEW:

Here is a simple example of how you get data from the database into LabVIEW:

71

71 SQL SQL ToolkitToolkit

Tutorial: Database Communication in LabVIEW Tutorial: Database Communication in LabVIEW

The procedure is as follows:

The procedure is as follows:

Step 1:

Step 1:

Step 2:

Step 2:

72

72 SQL SQL ToolkitToolkit

Tutorial: Database Communication in LabVIEW Tutorial: Database Communication in LabVIEW

Step 3 and 4:

Step 3 and 4:

Step 5:

Step 5:

73

73 SQL SQL ToolkitToolkit

Tutorial: Database Communication in LabVIEW Tutorial: Database Communication in LabVIEW

Step 6:

Step 6:

Step 7:

Step 7:

74

74 SQL SQL ToolkitToolkit

Tutorial: Database Communication in LabVIEW Tutorial: Database Communication in LabVIEW

Step 8:

Step 8:

Telemark University College Telemark University College

Faculty of Technology Faculty of Technology

Kjølnes Ring 56 Kjølnes Ring 56 N-3914 Porsgrunn, Norway N-3914 Porsgrunn, Norway

www.hit.no www.hit.no

Hans-Petter Halvorsen, M.Sc.

Hans-Petter Halvorsen, M.Sc.

Telemark University College Telemark University College

Department of Electrical Engineering, Information Technology and Cybernetics Department of Electrical Engineering, Information Technology and Cybernetics

Phone: +47 3557 5158 Phone: +47 3557 5158 E-mail:

E-mail: [email protected]@hit.no Blog:

Blog: http://home.hit.no/~hansha/http://home.hit.no/~hansha/

Room: B-237a Room: B-237a

In document Database Communication in LabVIEW (Page 74-81)

Related documents