广州中铁荔湾国际城:初学c#,请问怎么判断读入数据是否有效?

来源:百度文库 编辑:高考问答 时间:2024/07/03 08:55:30
string strSql;
strSql = "select abc from [数据表]";
SqlCommand cmd = m_sqlconn.CreateCommand();
cmd.CommandText = strSql;
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = cmd;
DataTable dt = new DataTable();
sda.Fill(dt);
dataGridView1.DataSource = dt;
然后我在程序里面怎么判断查询返回的abc是否为空,还有返回行数等等,希望高手解决一下我的这个低级问题,呵呵。


应该是dt.Rows.count

abc.Rows.Count>0不为空,Count就是具体的行数