-
May 10th, 2014, 08:33 PM
#1
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.
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace somecityform
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
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");
con.Open();
SqlCommand cmd = new SqlCommand("Insert into somecity.staff (forename, surname, office, email) Values ('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|