|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using FireBird.SqlAssistant;
namespace Demo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.textBox1.Text = SQLAssistant.GetIniQuery("MyQuery1");
this.textBox2.Text = SQLAssistant.GetIniQuery("MyQuery2");
}
private void button1_Click(object sender, EventArgs e)
{
this.RefreshData();
}
private void RefreshData()
{
this.dataGridView1.DataSource = SQLAssistant.Execute("SELECT * FROM COUNTRY").Tables[0];
}
private void button2_Click(object sender, EventArgs e)
{
string c = SQLAssistant.GetCount("COUNTRY").ToString();
string v1 = "ACountry" + c;
string v2 = "ACurr" + c;
SQLAssistant.Insert("COUNTRY", "COUNTRY", v1, "CURRENCY", v2);
this.RefreshData();
MessageBox.Show("COUNTRY='" + v1 + "' added successfully");
}
private void button3_Click(object sender, EventArgs e)
{
DataTable table = SQLAssistant.Select("COUNTRY", "COUNTRY", "USA").Tables[0];
if (table == null || table.Rows.Count == 0)
{
MessageBox.Show("COUNTRY='USA' not found");
return;
}
DataRow row = table.Rows[0];
row["CURRENCY"] = "$";
SQLAssistant.Update("COUNTRY", table.Rows[0], "COUNTRY", "USA");
MessageBox.Show("CURRENCY='Dollar' is successfully updated to '$'");
this.RefreshData();
}
private void button4_Click(object sender, EventArgs e)
{
SQLAssistant.Insert("COUNTRY", "COUNTRY", "TestCountry", "CURRENCY", "None");
DataTable table = SQLAssistant.Select("COUNTRY", "COUNTRY", "TestCountry").Tables[0];
if (table == null || table.Rows.Count == 0)
{
MessageBox.Show("COUNTRY='TestCountry' not found");
return;
}
DataRow row = table.Rows[0];
SQLAssistant.Delete("COUNTRY", row);
MessageBox.Show("COUNTRY='TestCountry' is deleted successfully");
this.RefreshData();
}
private void button6_Click(object sender, EventArgs e)
{
this.dataGridView2.DataSource = SQLAssistant.ExecuteIni("MyQuery1").Tables[0];
}
private void button5_Click(object sender, EventArgs e)
{
this.dataGridView2.DataSource = SQLAssistant.ExecuteIni("MyQuery2").Tables[0];
}
private void button7_Click(object sender, EventArgs e)
{
this.dataGridView3.DataSource = SQLAssistant.ExecuteDataSet("ORG_CHART ", null).Tables[0];
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here