这是我的计数。尝试检查数据集的行数,但得到错误:
对象引用未设置为if处的对象实例 (ds.Tables [" GetCaseInformationByCaseStatusANDCaseNumber"] Rows.Count。 != 0)。
请帮忙。
using (SqlCommand GetCaseInformationByCaseStatusANDCaseNumberSP = new SqlCommand("GetCaseInformationByCaseStatusANDCaseNumberSP", Apptestconn))
{
GetCaseInformationByCaseStatusANDCaseNumberSP.CommandType = CommandType.StoredProcedure;
GetCaseInformationByCaseStatusANDCaseNumberSP.Parameters.AddWithValue("@UserName", "nguyenlc");
GetCaseInformationByCaseStatusANDCaseNumberSP.Parameters.AddWithValue("@CaseStatus", TextBox1.Text);
GetCaseInformationByCaseStatusANDCaseNumberSP.Parameters.AddWithValue("@CaseNumber", CaseNumberTextBox.Text);
GetCaseInformationByCaseStatusANDCaseNumberSP.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(GetCaseInformationByCaseStatusANDCaseNumberSP);
DataSet ds = new DataSet();
da.Fill(ds, "GetCaseInformationByCaseStatusANDCaseNumberTable");
ReviewCaseStatusListView.DataSource = ds.Tables["GetCaseInformationByCaseStatusANDCaseNumberTable"];
ReviewCaseStatusListView.DataBind();
if (ds.Tables["GetCaseInformationByCaseStatusANDCaseNumberTable"] != null)
{
if (ds.Tables["GetCaseInformationByCaseStatusANDCaseNumber"].Rows.Count != 0)
{
CaseUploadHistoryLabel.Text = "Case Upload History:";
CaseUploadHistoryLabel.Visible = true;
}
}
}