Book_Id Numric( 10,0) Book_Name Varchar(20), Book_Autor varehar(20), Book_Price varchar(20) Accept Bookld from user and delete the record from table(sql server 2005)
Loading
Book_Id Numric( 10,0) Book_Name Varchar(20), Book_Autor varehar(20), Book_Price varchar(20) Accept Bookld from user and delete the record from table(sql server 2005)
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question.
Satyapriya NayakPosted Apr 7, 2013, 2:17 PM
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace Gridview
{
public partial class WebForm3 : System.Web.UI.Page
{
string connStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlCommand com;
string str;
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(connStr);
con.Open();
str = "Delete from book where Book_Id='"+TextBox1.Text+"'";
com = new SqlCommand(str, con);
com.ExecuteNonQuery();
con.Close();
Response.Write("Deleted");
}
}
}
xenoix babaPosted Apr 7, 2013, 3:19 PM