Entrambe le proprietà indicate sopra sono da impostare attraverso le AdvacedProperties dell'IOServer. Se la tabella non esiste viene create automaticamente in fase di avvio ed è strutturata nel seguente modo:
Di seguito un esempio di utilizzo dei driver IToolS SQL:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace TestSqlDriver { public class Form1 : Form { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; private IToolS.Windows.Forms.Variables.VariablesWindow variablesWindow1; private IToolS.Components.IOServers.IOServer ioServer1; private IToolS.Components.Communication.Clients clients1; private IToolS.Components.Communication.Client client1; private IToolS.Components.Communication.Group group1; private IToolS.Components.Communication.Variable variable1; private IToolS.Components.Communication.Variable variable2; private IToolS.Components.Communication.Variable variable3; private IToolS.Components.Communication.Variable variable4; private IToolS.Windows.Forms.TextBox textBox1; private IToolS.Components.Communication.Variable variable5; public Form1() { InitializeComponent(); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.variablesWindow1 = new IToolS.Windows.Forms.Variables.VariablesWindow(); this.group1 = new IToolS.Components.Communication.Group(this.components); this.variable1 = new IToolS.Components.Communication.Variable(this.components); this.variable2 = new IToolS.Components.Communication.Variable(this.components); this.variable3 = new IToolS.Components.Communication.Variable(this.components); this.variable4 = new IToolS.Components.Communication.Variable(this.components); this.variable5 = new IToolS.Components.Communication.Variable(this.components); this.ioServer1 = new IToolS.Components.IOServers.IOServer(this.components); this.clients1 = new IToolS.Components.Communication.Clients(this.components); this.client1 = new IToolS.Components.Communication.Client(this.components); this.textBox1 = new IToolS.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.variablesWindow1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.group1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.variable1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.variable2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.variable3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.variable4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.variable5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ioServer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.clients1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.client1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.textBox1)).BeginInit(); this.SuspendLayout(); // // variablesWindow1 // this.variablesWindow1.ColumnColor = System.Drawing.SystemColors.Control; this.variablesWindow1.EditKeyboardConfig.Font = new System.Drawing.Font("Tahoma", 8F); this.variablesWindow1.Fields = new string[] { "VariableName", "VariableType", "Area", "Address", "Value"}; this.variablesWindow1.Group = this.group1; this.variablesWindow1.KeyboardConfig.Font = new System.Drawing.Font("Tahoma", 8F); this.variablesWindow1.Location = new System.Drawing.Point(12, 12); this.variablesWindow1.Name = "variablesWindow1"; this.variablesWindow1.Size = new System.Drawing.Size(765, 380); // // group1 // this.group1.GroupName = "group1"; this.group1.Items.AddRange(new IToolS.Components.Communication.Variable[] { this.variable1, this.variable2, this.variable3, this.variable4, this.variable5}); // // variable1 // this.variable1.Address = "0"; this.variable1.VariableName = "variable1"; // // variable2 // this.variable2.Address = "2"; this.variable2.VariableName = "variable2"; this.variable2.VariableType = "String"; // // variable3 // this.variable3.Address = "100"; this.variable3.VariableName = "variable3"; // // variable4 // this.variable4.Address = "104"; this.variable4.VariableName = "variable4"; this.variable4.VariableType = "Long"; // // variable5 // this.variable5.Address = "104"; this.variable5.VariableName = "variable5"; this.variable5.VariableType = "Real"; // // ioServer1 // this.ioServer1.AdvancedProperties.Add(new IToolS.Data.Base.AdvancedProperty("ConnectionString", "Data Source=localhost\\SqlExpress;Initial Catalog=IToolS;Integrated Security=SSPI;")); this.ioServer1.Name = "SqlStore"; // // clients1 // this.clients1.ClientsName = "clients1"; this.clients1.Items.AddRange(new IToolS.Components.Communication.Client[] { this.client1}); // // client1 // this.client1.ClientName = "client1"; this.client1.Group = this.group1; this.client1.IOServer = this.ioServer1; // // textBox1 // this.textBox1.KeyboardConfig.Font = new System.Drawing.Font("Tahoma", 8F); this.textBox1.Location = new System.Drawing.Point(355, 399); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(100, 20); this.textBox1.TabIndex = 1; this.textBox1.Variable = this.variable2; this.textBox1.WriteVariableOnKeyboardEnter = true; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(789, 440); this.Controls.Add(this.textBox1); this.Controls.Add(this.variablesWindow1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.variablesWindow1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.group1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.variable1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.variable2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.variable3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.variable4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.variable5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ioServer1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.clients1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.client1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.textBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } private void Form1_Load(object sender, EventArgs e) { clients1.Start(); } } }
Lo stesso driver è disponibile anche per MySql impostando la proprietà "Name" dell'IOServer a "MySqlStore".
IToolS Blog