namespace Amount
{
public partial class Form1 : Form
{
OleDbCommand cmd;
OleDbConnection con;
DataTable dt;
OleDbDataAdapter da;
public void DataConnection()
{
con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=./Amount.mdb");
con.Open();
}
public Form1()
{
InitializeComponent();
}
private void btnAmount_Click(object sender, EventArgs e)
{
DataConnection();
cmd = new OleDbCommand("Insert into tblAmount(SerialNumber,Amount)values(" + textBox1.Text + "," + textBox2.Text + ")", con);
cmd.ExecuteNonQuery();
textBox1.Text = "";
textBox2.Text = "";
MessageBox.Show("Data inserted successfully");
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
|