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();
单击图像按钮之后。
问题是,当我尝试删除一个数据表只有一行,但它删除两个数据表的内容。