在查询中动态获取行ID

时间:2015-08-22 06:21:13

标签: c# sql asp.net

假设我在gridview中有4行,并且我只想删除第二行,那么如何从表中获取动态ID,以便我可以删除具有唯一ID的特定行

这是我的查询,但我无法提供相应的ID: -

protected void GrdTraining_DeleteCommand(object sender, Obout.Grid.GridRecordEventArgs e)
{
    if (Session["dt10"] != null)
    {
        dt10 = (DataTable)Session["dt10"];
    }
    else
    {
        BindDatatable();
    }
    DataRow[] grdTrain = dt10.Select("SR_NO=" + Convert.ToString(e.Record["SR_NO"]));
    dt10.Rows.Remove(grdTrain[0]);
    AddToViewState("GrdTraining");
    CF.ExecuteDT("DELETE FROM EMP_ATTACHED_DOCUMENTS where mkey="+ );  // mkey is my unique column in the table, how to get the ID here for the row which I want to delete ?? 
}

请建议

0 个答案:

没有答案