|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace SampleApp
{
/// <summary>
/// Summary description for ExecTransaction.
/// </summary>
public class ExecTransaction : System.Windows.Forms.Form
{
private System.Windows.Forms.RichTextBox txtSQL;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnRun;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public ExecTransaction()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnRun = new System.Windows.Forms.Button();
this.txtSQL = new System.Windows.Forms.RichTextBox();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btnRun
//
this.btnRun.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnRun.Location = new System.Drawing.Point(352, 280);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(96, 23);
this.btnRun.TabIndex = 5;
this.btnRun.Text = "Run";
this.btnRun.Click += new System.EventHandler(this.button1_Click);
//
// txtSQL
//
this.txtSQL.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtSQL.Location = new System.Drawing.Point(16, 24);
this.txtSQL.Name = "txtSQL";
this.txtSQL.Size = new System.Drawing.Size(432, 216);
this.txtSQL.TabIndex = 6;
this.txtSQL.Text = "";
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label1.Location = new System.Drawing.Point(16, 248);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(424, 16);
this.label1.TabIndex = 7;
this.label1.Text = "Each Line must be single SQL statement";
//
// ExecTransaction
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(464, 310);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtSQL);
this.Controls.Add(this.btnRun);
this.Name = "ExecTransaction";
this.Text = "ExecTransaction";
this.Load += new System.EventHandler(this.ExecTransaction_Load);
this.ResumeLayout(false);
}
#endregion
private void button1_Click(object sender, System.EventArgs e)
{
bool result=DBLayer.DB.ExecuteTransaction(txtSQL.Lines);
if(result)
MessageBox.Show(this,"Transaction Completed Successfully");
else
MessageBox.Show(this,"Transaction Hasn't Completed");
}
private void ExecTransaction_Load(object sender, System.EventArgs e)
{
txtSQL.Text+="Insert into orders values('LEHMS',4,19/08/1996,16/09/1996,27/08/1996,1,76.56,'Lehmanns Marktstand','Magazinweg 7','Frankfurt a.M.','RJ','02389-890','Brazil')";
}
}
}
|
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
Egyption ,B.Sc in computer science Department from faculty of computer science and information system Egypt-Helwan Univeristy ,
my master in progress in intelligent systems in Vienna Technology university ,
Microsoft Certified Professional science 2003 experience with
Turbo Pascal ,C++,VC++,C#,VB.NET,J# ,asp,ASP.Net,COM+ & XML , sql server 2000,action script 2
I have B.Sc in Computer Science , Microsoft Certified Solution Developer and experienced with C/C++,MFC,C#,VB.NET,ASP.NET,XML,SQL Server 2000 & Crystal Reports.I like challenge and enjoy working with new technologies.