- string sqlcon = "Server=.;Database=CSL;Uid=rawbol;Pwd=123456";
- string sqlquery1 = "select ID from ACCOUNT where ID='"+textBox1.Text+"'";
- con.Open();
- SqlCommand sqlc1 = new SqlCommand(sqlquery1, con);
- Object obj = sqlc1.ExecuteScalar();
- string str1 = textBox1.Text;
- string str2 = Convert.ToString( obj );
- //MessageBox.Show(str2);
- MessageBox.Show(Convert.ToString(obj.Equals("admin")));
复制代码 SQL查询结果为admin,MessageBox.Show(obj)显示结果为admin,但是MessageBox.Show(Convert.ToString(obj.Equals("admin")))显示结果却是false,为什么????? |