Hello friends. This is My Second Post
Delete Record from SQL 2005 using C# code and ASP.Net web Application
To view the Insert coding and other details please follow MY this Link.
http://sandeepraojabalpur.blogspot.in/2012/07/insert-querry-in-sql-database-using.html
In This Section I am only writing the Delete Coding.
protected void Button2_Click(object sender, EventArgs e)
{
string cs = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True";
cn = new SqlConnection(cs);
cn.Open();
string k = "delete from Table1 where roll='" + TextBox1.Text + "'";
cm = new SqlCommand(k, cn);
cm.ExecuteNonQuery();
Response.Write("Data Deleted from Database");
TextBox1.Text = "";
TextBox2.Text = "";
}
Delete Record from SQL 2005 using C# code and ASP.Net web Application
To view the Insert coding and other details please follow MY this Link.
http://sandeepraojabalpur.blogspot.in/2012/07/insert-querry-in-sql-database-using.html
In This Section I am only writing the Delete Coding.
using
System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
SqlDataReader
dr;
SqlCommand
cm;
SqlConnection
cn;
protected void Page_Load(object
sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
string cs = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True";
cn = new SqlConnection(cs);
cn.Open();
string k = "delete from Table1 where roll='" + TextBox1.Text + "'";
cm = new SqlCommand(k, cn);
cm.ExecuteNonQuery();
Response.Write("Data Deleted from Database");
TextBox1.Text = "";
TextBox2.Text = "";
}