0
我沒有成功嘗試另一個函數來創建一個新的DataTable(從另一個數據表)刪除第一行DataTable中
Session["Tissues"] = tableword;// I dont load them again
Session["Randomtable"] = tableword;
,基本上我需要的是刪除數據表的第一行中的一個後面的代碼表。
private void Question_table()
{
if (Session["Tissues"] != null)
{
DataTable table_word = (DataTable)Session["Tissues"];
DataTable table_random = (DataTable)Session["Randomtable"];
GridView3.DataSource = table_random;
GridView3.DataBind();
string q_name = "";
DataRow row = table_word.Rows[0];
if (row["name"] != null) // This will check the null values also (if you want to check).
{
// Do whatever you want.
q_name = row["name"].ToString();
}
if (row["image"] != null) // This will check the null values also (if you want to check).
{
q_image = row["image"].ToString();
}
Next_Question(q_name, q_image, table_random);
Label3.Text = q_name;
Label4.Text = q_image;
row.Delete();
// table_word.Rows.RemoveAt(0);
// table_word.Rows.Remove(row);
// table_word.Rows.Remove(table_word.Rows[0]);
Session["Tissues"] = table_word;
}
}
,我叫
Question_table();
單擊圖像按鈕之後。
問題是,當我嘗試刪除一個數據表只有一行,但它刪除兩個數據表的內容。