Dear Mohi,
You need to specify what kind of popup window you want to make. (You can use link of a image to specify it)
And for inserting data in sql server you can use the following code:
private void button2_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Data Source:.;Initial Catalog=database_name;Integrated Security=true");
SqlCommand cmd = new SqlCommand("Insert into table_name values(@a,@b)", conn);
conn.Open();
cmd.Parameters.AddWithValue("@a", textBox1.Text.ToString());
cmd.Parameters.AddWithValue("@b", textBox2.Text.toString());
cmd.ExecuteNonQuery();
MessageBox.Show("You data has been saved successfully");
conn.Close();
}
Explanation of Coding:
First of all, in the click event of button1 I have created a connection to sql sever using SqlConnection. I have passed Data Source(Server Name),Initial Catalog(Database Name), Integrated Security as true(as my sql server was running on windows security) after that I have created command for sql db usig SqlCommand class from System.Data.SqlClient .
After that I have opened the connection state and added the specified parameters in the command.
Then I have executed the query and then displayed the message and then closed the connection.
Hope it helps! Happy Coding!!
Akky