Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void savebuyers_Click(object sender, RoutedEventArgs e)
- {
- string connectionstring = null;
- connectionstring = "Data Source=FRANCIS;Initial Catalog=Pam Golding;Integrated Security=SSPI";
- SqlConnection con = new SqlConnection(connectionstring);
- try
- {
- string query;
- query = "insert into buyers (name,number,email) values ('" + namebuyers.Text + "'," + Convert.ToInt32(numberbuyers) + ",'" + emailbuyers.Text + "')";
- SqlCommand command = new SqlCommand(query, con);
- message1.Text = "Data Saved Successfully!";
- con.Open();
- command.ExecuteNonQuery();
- con.Close();
- }
- catch
- {
- message1.Text = "Error While Saving Data!";
- }
- }
- Convert.ToInt32(numberbuyers.Text)
Add Comment
Please, Sign In to add comment