Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Asp.net delete data from dataset and database in disconnected mode

$
0
0
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string ph = ds.Tables[0].Rows[e.RowIndex][0].ToString();
        adpt = new SqlDataAdapter();
        comm = new SqlCommand();
        comm.CommandText = "delete from Categories where CategoryID = " + ph;
        comm.CommandType = CommandType.Text;
        comm.Connection = con;
       
        adpt.DeleteCommand = comm;
       
        adpt.Update(ds);

        select();

        GridView1.DataSource = ds;
        GridView1.EditIndex = -1;
        GridView1.DataBind();
    }



this code is supposed to delete a record in dataset and then delete it from database using the gridview, it doesn't generate any errors but it doesn't delete the record from the dataset

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>