本文介绍了asp中的数据表错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请参见代码:
please see the code:
SqlConnection con = Database.GetConnection(); SqlCommand cmd = new SqlCommand("spArticleCategoryWise", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@cat_id", cat_ID); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); DataTable dt = (DataTable)ds.Tables["spArticleCategoryWise"]; int totalrows = dt.Rows.Count; Label1.Text = totalrows.ToString();Error:Object reference not set to an instance of an object.
请帮助我 在此先感谢
please help me Thanks in advance
推荐答案发生错误的地方? 这仅表示您正在尝试使用null对象的属性(该对象为null). 因此,将断点放入代码中,进行调试和修复.检查这些对象中的数据. In which the error occurs? It simply means that you are trying to use a property of an null object(the object is null). So, put breakpoints in your code, debug & fix yourself. Check data in those objects.
更多推荐
asp.net中的数据表错误
发布评论