|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MySql.Data;
using MySql.Data.MySqlClient;
namespace StoredProcs
{
public partial class Form1 : Form
{
clsKenTest ken;
string ans;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
ken = new clsKenTest("server=localhost;userid=demo;database=test;pooling=true");
}
private string go(string sql)
{
try
{
return ken.ExecSql(sql);
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message);
return ex.Message;
}
}
private void CreateTable_Click(object sender, EventArgs e)
{
ans = go(ken.table);
txtTable.Text = ans;
}
private void DropProc_Click(object sender, EventArgs e)
{
ans = go(ken.drop);
txtDropProc.Text = ans;
}
private void CreateProc_Click(object sender, EventArgs e)
{
ans = go(ken.proc);
txtCreateProc.Text = ans;
}
private void spInsert_Click(object sender, EventArgs e)
{
ans = ken.DoInsert(ken.nsert);
txtInsert.Text = ans;
}
private void proc2_Click(object sender, EventArgs e)
{
ans = ken.runProc();
if (ans.Equals("OK"))
{
txtProc2.Text = ken.lastinsertid.ToString();
txtConcat.Text = ken.newval;
}
else
{
txtProc2.Text = ans;
txtConcat.Text = "Error";
}
}
}
}
|
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.