本文介绍了引用未被删除重新访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 您好, 我再次就下一个问题请求帮助,之前的问题没有给出 解决方案。 这条消息底部的方法留下了对somethig的引用,因为我可以告诉_sqladapter变量。正如你所看到的那样,我使用 ''使用''语句,所以适配器和连接应该整齐地处理掉。 但是它不会! 我会祈祷解决方案。 谢谢 Frank 公共DataTable lees() { string ConnectString =" Server = localhost;数据库= AA;用户 id = uniserver;密码= aa;连接超时= 100;" ;; DataSet _DataSet = new DataSet(); string StoredProcedure =" S_aa"; using(SqlConnection _SqlConnection = new SqlConnection(ConnectString)) { using(SqlDataAdapter _SqlDataAdapter = new SqlDataAdapter(StoredProcedure,_SqlConnection)) { 试试 { _SqlDataAdapter .SelectCommand.CommandType = CommandT ype.StoredProcedure; _SqlDataAdapter.Fill(_DataSet,StoredProcedure); _SqlDataAdapter.SelectCommand = null; } catch(SqlException e) { Console.WriteLine(StoredProcedure + e.Message + e.Stac kTrace); } } } 返回_DataSet.Tables [0]; }Hello,I again ask for help on the next problem, a previous question did not give asolution.The method at the bottom of this message leaves a reference to somethig, asfar as I can tell to the _sqladapter variable. As you can see I use the''using'' statement so the adapter and the connection should be neatlydisposed of.But it doesn''t!I will be praying for a solution.ThanksFrankpublic DataTable lees(){string ConnectString="Server= localhost; database=aa; Userid=uniserver;password=aa;Connect Timeout=100;";DataSet _DataSet= new DataSet();string StoredProcedure="S_aa";using (SqlConnection _SqlConnection= new SqlConnection(ConnectString)){using (SqlDataAdapter _SqlDataAdapter = newSqlDataAdapter(StoredProcedure,_SqlConnection)){try{_SqlDataAdapter.SelectCommand.CommandType=CommandT ype.StoredProcedure;_SqlDataAdapter.Fill(_DataSet,StoredProcedure);_SqlDataAdapter.SelectCommand=null;}catch (SqlException e){Console.WriteLine(StoredProcedure+e.Message+e.Stac kTrace);}}}return _DataSet.Tables[0];}推荐答案 这篇关于引用未被删除重新访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-28 11:09