asp.net中的数据表错误

编程入门 行业动态 更新时间:2024-10-12 01:29:17
本文介绍了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中的数据表错误

本文发布于:2023-07-09 21:19:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1088240.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据表   错误   asp   net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!