protected void Button2_Click(object sender, EventArgs e) { if (txtEng.Text != "" && txtRus.Text != "") { string engName = txtEng.Text; string rusName = txtRus.Text; string comment = txtComment.Text; string DoB = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); GeneratedName name = new GeneratedName(engName, rusName, DoB, comment); Logger.LogName(name); } }
public static void LogName(GeneratedName name) { MySQLConn connection = new MySQLConn(); connection.OpenConnection(); try { string command = "insert into log (`eng_name`, `rus_name`, `date_of_birth`, `comment`) values ('" + name.EngName + "', '" + name.RusName + "', '" + name.DateOfBirth + "', '" + name.Comment + "')"; MySqlCommand sqlCom = new MySqlCommand(command, MySQLConn.conn); sqlCom.ExecuteNonQuery(); } finally { connection.CloseConnection(); } }