datatable.Rows[0]["abc"]怎么判断是不是null 或者是不是空值
DataTabledtc=CityManager.GetTableCityTypeId(Convert.ToInt32(Id));if(dtc.Rows.Count>0)...
DataTable dtc = CityManager.GetTableCityTypeId(Convert.ToInt32(Id));
if (dtc.Rows.Count > 0)
{
if (dtc.Rows[0]["CityName"] == null || dtc.Rows[0]["CityName"].ToString() == "")
{
City1 = "";
}
else
{
City1 = dtc.Rows[0]["CityName"].ToString();
CityId1 = dtc.Rows[0]["CityId"].ToString();
}
if (dtc.Rows[1]["CityName"] == null || dtc.Rows[1]["CityName"].ToString() == "")
{
City2 = "";
}
else
{
City2 = dtc.Rows[1]["CityName"].ToString();
CityId2 = dtc.Rows[1]["CityId"].ToString();
} }
dtc.Rows[1]["CityName"] == null || dtc.Rows[1]["CityName"].ToString() == ""
这样不好使???怎么判断好使 展开
if (dtc.Rows.Count > 0)
{
if (dtc.Rows[0]["CityName"] == null || dtc.Rows[0]["CityName"].ToString() == "")
{
City1 = "";
}
else
{
City1 = dtc.Rows[0]["CityName"].ToString();
CityId1 = dtc.Rows[0]["CityId"].ToString();
}
if (dtc.Rows[1]["CityName"] == null || dtc.Rows[1]["CityName"].ToString() == "")
{
City2 = "";
}
else
{
City2 = dtc.Rows[1]["CityName"].ToString();
CityId2 = dtc.Rows[1]["CityId"].ToString();
} }
dtc.Rows[1]["CityName"] == null || dtc.Rows[1]["CityName"].ToString() == ""
这样不好使???怎么判断好使 展开
2个回答
2015-01-28
展开全部
dtc.Rows[1].IsNull("CityName") == true
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询