private void cmdsecadd_Click(object sender, EventArgs e)
{
try
{
string myConnection = "server=localhost; port=3306; username=root; password=palo; database= student";
MySqlConnection myConn = new MySqlConnection(myConnection);
myConn.Open();
MySqlCommand cmd = new MySqlCommand("insert into student.tblstudlog (studentnumber, fullname, year, section) values ('" + this.txtstudno.Text + "', '" + this.txtfullname.Text + "','" + this.txtyear.Text + "','" + this.txtsection.Text + "';", myConn);
myConn.Close();
}
catch (MySqlException ex)
{
MessageBox.Show("Can't connect to database\n" + ex.ToString());
}
rach.palo 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.