Delete Method using ObjectDataSource in Asp.Net | Delete Data for Gridview using ObjectDataSource

preview_player
Показать описание
Hello Friends,

If You like our video and want to support our channel, try to do donations through the link given below :

Download Our All 400+ Asp.Net Code : Just Paying Onetime Amount Rs.49/- Only
Buy and Download All 400+ Codes Here ( 100% Working Code ) :

or

You can also buy our pendrive of 32GB Which will include 400+Videos in Mp4 Format So You can watch all Videos Without Internet and Learn Asp.Net in Hindi At Your Home Easily. We will send you the pendrive through Courier. You have to pay Just Rs.999/- ( Include All Source Code File + 400+Videos + 32GB Pendrive ) Only For Indian Users
Buy Our Pendrive Here :

Thanks for watching Our Videos. Subscribe Our Channel For More Updated Videos.

------------
Coding
---------------------------
public DataSet GetCustomerDetail1()
{
String constring = "Data Source=VIKAS-PC\\SQLEXPRESS; Initial Catalog=customerdatabase; Integrated Security=true";
SqlConnection sqlcon = new SqlConnection(constring);
String query = "select * from customerdetail";
SqlCommand sqlcmd = new SqlCommand();
sqlcmd.CommandText = query;
sqlcmd.Connection = sqlcon;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = sqlcmd;
DataSet ds = new DataSet();
da.Fill(ds);
return ds;

}

public void deleteCustomerDetail1(int customerid)
{
String constring = "Data Source=VIKAS-PC\\SQLEXPRESS; Initial Catalog=customerdatabase; Integrated Security=true";
SqlConnection sqlcon = new SqlConnection(constring);
SqlCommand sqlcmd = new SqlCommand("delete from customerdetail where customerid=" + customerid, sqlcon);
sqlcon.Open();
sqlcmd.ExecuteNonQuery();
sqlcon.Close();

}

----
Рекомендации по теме
Комментарии
Автор

Sir Insert, Update, Delete Method Tino Ek Sath Batao plz.
Using ObjectDataSource.

BeHappy-wsbh
Автор

Hello Sir I Have Wrote This Code But While Clicking On Delete Button Nothing Is Happening .
Here Is My Code .
public static void DeleteStudent(int ID)
{
String cs = "Data Source=USER-PC\\LOCAL;Initial Catalog=STUDENT;Integrated Security=True";
SqlConnection con = new SqlConnection(cs);
cmd.Parameters.Add(param);
con.Open();
cmd.ExecuteNonQuery();
con.Close();

}

I Have Wrote This Using ObjectDataSource.

BeHappy-wsbh
visit shbcf.ru