SqlConnection conn = new SqlConnection("Server=purana;DataBase=test;Integrated Security=SSPI");
SqlDataAdapter ada = new SqlDataAdapter("Select * From dateTable",conn);
conn.Open();
DataSet dataSet = new DataSet();
ada.Fill(dataSet,"dateTable");
DataTable dtSource = dataSet.Tables[0];
conn.Close();
for(int i = 0 ;i < dtSource.Rows.Count;i++)
{
if(dtSource.Rows[i]["dateNow"].GetType()==typeof(DBNull)) {
MessageBox.Show("第"+(1+i).ToString()+"行中的值为Null");
}
}
MessageBox.Show("完成");