Configure database connections and execute queries.
Tutorials → Datasets | Tutorial | How-to Guide | Reference
Configure database connections
Create queries with parameters
Display data in tables
Name: ProductionDB
Provider: SQLite Data Provider
Database: .Net Framework Data Provider for SQLite
ConnectionString: [Auto-configured]
Name: ProductionDB
Provider: SqlClient Data Provider
Database: SQL Server Database
ConnectionString:
Data Source=SERVER\INSTANCE;
Initial Catalog=Production (your database name);
Info
These tables will not be used further in this Tutorial, once there is no data available. If you have a database table with data, feel free to use, if not you can use the Table created on the Historian Module Tutorial
ActiveOrders
SELECT "TankFarm/Tank1/Temperature" FROM ProcessData
SELECT "TankFarm/Tank1/Temperature" FROM ProcessData WHERE UTCTimestamp_Ticks >= (strftime('%s', {Tag.TankFarm/Tank1/Temperature.Timestamp}, '-10 days') * 10000000) + 621355968000000000
@Dataset.Query.ActiveOrders
Create button to run query:
csharp
public void MouseLeftButtonDown1(object sender, System.Windows.Input.InputEventArgs e)
{
DataTable results = @Dataset.Query.ActiveOrders.SelectCommand();
}
Debug
You can use the Debugging Scripts Code to debug this piece of code and view the values in the "results" variable
→ Modules / Business Operations / Datasets Module → Tutorials / Business Operations / Datasets Module Tutorial → How-to Guides / I Business Operations / Datasets Module How-to Guide → Technical Reference / Business Operations / Datasets Module ReferenceDatasets Module Links
Explanation - to understand concepts
Tutorials - to learn by doing
How-to Guides - to accomplish specific tasks
Reference - technical details