You are on page 1of 1

Jomar De Juan

Jhon Christer Centeno

Carl Dustin Espina

Aldrin Balantad

public partial class Form2 : Form


{
public OleDbConnection create = new OleDbConnection();
public Form2()
{
InitializeComponent();
create.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\users\aldrin\documents\visual studio
2013\Projects\WindowsFormsApplicationREcreate\WindowsFormsApplicationREcreate\Database1.mdb
";
}
private Form1 f1 = new Form1();
private void button1_Click(object sender, EventArgs e)
{
f1.connection.Open();
OleDbCommand cmd = f1.connection.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "INSERT INTO Students ([FirstName], [LastName], [MidtermGrade],
[Password], [SEX])" + "VALUES ('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" +
textBox4.Text + "','" + comboBox1.Text + "')";
cmd.ExecuteNonQuery();
MessageBox.Show("Registration Successful");
f1.connection.Close();
this.Close();
}
}
}

You might also like