我有public static DataTable GetTable()
我还使用以下方法获取了我的数据表的值
DataTable table = new DataTable();
table = GetTable();
string expression;
expression = "B.Id = " + textBox1.Text;
DataRow[] foundRows;
foundRows = table.Select(expression);
for (int i = 0; i < foundRows.Length; i++)
{
sno.Text = foundRows[i][1].ToString();
name.Text = foundRows[i][2].ToString();
dcn.Text = foundRows[i][3].ToString();
stat.Text = foundRows[i][4].ToString();
}
那么如何更改目前使用以下代码的foundRows [i] [4]的值
DataTable table = new DataTable();
table = GetTable();
string expression;
expression = "B.Id = "+textBox1.Text;
DataRow[] foundRows;
foundRows = table.Select(expression);
for(int i = 0; i < foundRows.Length; i ++)
{
if(button1.Text == "Make Preasent!")
{
foundRows[i].SetField(4, true);
table.AcceptChanges();
}
else
{
foundRows[i].SetField(4, false);
table.AcceptChanges();
}
}
但它不会改变值 这是`timer.OnTick()
if (textBox1.TextLength < 9 || textBox1.TextLength > 9)
{
sno.Text = "";
name.Text = "";
dcn.Text = "";
stat.Text = "";
button1.Text = "";
}
try
{
//textBox1.Text = textBox1.Text.Replace("ONE", "1");
//textBox1.Text = textBox1.Text.Replace("g", "");
table = GetTable();
expression = "B.Id = " + textBox1.Text;
foundRows = table.Select(expression);
for (int i = 0; i < foundRows.Length; i++)
{
if(textBox1.TextLength ==9)
{
sno.Text = foundRows[i][1].ToString();
name.Text = foundRows[i][2].ToString();
dcn.Text = foundRows[i][3].ToString();
stat.Text = foundRows[i][4].ToString();
if (foundRows[i][4].ToString()==true.ToString())
{
button1.Text = "Already Preasent!";
}
else if (foundRows[i][4].ToString() == false.ToString())
{
button1.Text = "Make Preasent!";
}
}
}
}
catch (Exception es)
{
if(textBox1.TextLength< 9)
{
}
else
{
// MessageBox.Show(es.Message);
}
}
`