SQL
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) 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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Apr 7, 2013, 10:17 AM EDT
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 baba40 reputationPosted Apr 7, 2013, 11:19 AM EDT