private void btnSubmit_Click(object sender, RoutedEventArgs e) { SqlConnection conn = new SqlConnection(Calorie_Counter_UK.Properties.Settings.Default.Calorie_CounterConnectionString); conn.Open(); try { using (SqlCommand command = new SqlCommand("INSERT INTO User (Name,Age,Height,Weight,Weight_Target) VALUES (@Name,@Age,@Height,@Weight,@Target)", conn)) ; { command.Parameters.Add(new SqlParameter("Name", txtName.Text)); command.Parameters.Add(new SqlParameter("Age", txtName.Text)); command.Parameters.Add(new SqlParameter("Height", txtName.Text)); command.Parameters.Add(new SqlParameter("Weight", txtName.Text)); command.Parameters.Add(new SqlParameter("target", txtName.Text)); Command.ExecuteNonQuery(); } } catch { MessageBox.Show("Could not Insert"); } }
INSERT INTO [User] (Name,Age,Height,Weight,Weight_Target) VALUES (@Name,@Age,@Height,@Weight,@Target)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)