为什么不行?求教解法。
源程序见下:
private void button1_Click(object sender, EventArgs e)
{
string a = Convert.ToString(myDataSet3.Tables[0].Rows[0][0]);
string b = "2";
MessageBox.Show(myDataSet3.Tables[0].Rows[0][4].GetType().ToString());
if (a==b)
allCell[0].Text = "== OK";
if (a.CompareTo(b)==0)
allCell[0].Text = "Compareto OK";
if (a.Equals(b))
allCell[0].Text = "Equals OK";
else
allCell[0].Text ="不行 "+ a.ToString() + a.ToString();
}
//test
private void button1_Click(object sender, EventArgs e)
{
string a = Convert.ToString(myDataSet3.Tables[0].Rows[0][4]);
string b = "星期五";
MessageBox.Show(myDataSet3.Tables[0].Rows[0][4].GetType().ToString());
if (a==b)
allCell[0].Text = "== OK";
if (a.CompareTo(b)==0)
allCell[0].Text = "Compareto OK";
if (a.Equals(b))
allCell[0].Text = "Equals OK";
//else
// allCell[0].Text ="不行 "+ a.ToString() + a.ToString();
}