Hi everyone. I am trying to insert values from text-boxes into a table named employee. There are no errors occurring when I execute the query but the values aren't being added. My code is as follows:
private void InsertEmployee()
{
string connectionSQL = "server=sql.byethost27.org;user id=xxxxx;password=xxxxx;database=xxxxx";
MySqlConnection conn = new MySqlConnection(connectionSQL);
try
{
conn.Open();
MySqlCommand cmd = new MySqlCommand("INSERT INTO Employee (Name,Address,City,State, ZipCode,Phone,Cell,DOB,Email,Start) VALUES ('" + name.Text + "', '" + Address.Text + "', '" + City.Text + "', '" + State.Text + "', '" + ZipCode.Text + "', '" + Phone.Text + "', '" + datePicker1.Text + "', '" + cell.Text + "', '" +Email.Text + "', '" + Start +"')", conn);
conn.Close();
}
catch (MySqlException ex)
{
MessageBox.Show("Can't connect to database\n" + ex.ToString());
}
}
Any help you can give me would be much appreciated
Many Thanks
Emma