May 10th, 2014, 08:33 PM
Windows Form Application C# - Confirmation Message on Add, Edit, Delete?
I have created a Windows C# Web Form Application in Visual Studio 2013 for adding, editing and deleting records in a database. I want to display a confirmation message whenever changes have been made to the database. What do I add and where do I add it? The code below is the opening part of the form and includes the insert query.
public partial class Form1 : Form
private void Form1_Load(object sender, EventArgs e)
private void label2_Click(object sender, EventArgs e)
private void button1_Click(object sender, EventArgs e)
SqlConnection con = new SqlConnection("Data Source=MY-PC;Initial Catalog=somecity;Integrated Security=True");
SqlCommand cmd = new SqlCommand("Insert into somecity.staff (forename, surname, office, email) Values ('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')", con);
May 20th, 2014, 08:29 PM
Re: Windows Form Application C# - Confirmation Message on Add, Edit, Delete?
if you are asking a really basic question, you can check with general samples as well.
MessageBox.Show("new row added!"); would work fine after the con.close() you have. You can also check the number of records that has changed before\after based on the rowcount in your table and then display that to the user. In every case, it has to be done AFTER the add\edit\save\delete ops are done.
Tags for this Thread
Click Here to Expand Forum to Full Width