F
Frank
Hello,
I again ask for help on the next problem, a previous question did not give a
solution.
The method at the bottom of this message leaves a reference to somethig, as
far 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 neatly
disposed of.
But it doesn't!
I will be praying for a solution.
Thanks
Frank
public DataTable lees()
{
string ConnectString="Server= localhost; database=aa; User
id=uniserver;password=aa;Connect Timeout=100;";
DataSet _DataSet= new DataSet();
string StoredProcedure="S_aa";
using (SqlConnection _SqlConnection= new SqlConnection(ConnectString))
{
using (SqlDataAdapter _SqlDataAdapter = new
SqlDataAdapter(StoredProcedure,_SqlConnection))
{
try
{
_SqlDataAdapter.SelectCommand.CommandType=CommandType.StoredProcedure;
_SqlDataAdapter.Fill(_DataSet,StoredProcedure);
_SqlDataAdapter.SelectCommand=null;
}
catch (SqlException e)
{
Console.WriteLine(StoredProcedure+e.Message+e.StackTrace);
}
}
}
return _DataSet.Tables[0];
}
I again ask for help on the next problem, a previous question did not give a
solution.
The method at the bottom of this message leaves a reference to somethig, as
far 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 neatly
disposed of.
But it doesn't!
I will be praying for a solution.
Thanks
Frank
public DataTable lees()
{
string ConnectString="Server= localhost; database=aa; User
id=uniserver;password=aa;Connect Timeout=100;";
DataSet _DataSet= new DataSet();
string StoredProcedure="S_aa";
using (SqlConnection _SqlConnection= new SqlConnection(ConnectString))
{
using (SqlDataAdapter _SqlDataAdapter = new
SqlDataAdapter(StoredProcedure,_SqlConnection))
{
try
{
_SqlDataAdapter.SelectCommand.CommandType=CommandType.StoredProcedure;
_SqlDataAdapter.Fill(_DataSet,StoredProcedure);
_SqlDataAdapter.SelectCommand=null;
}
catch (SqlException e)
{
Console.WriteLine(StoredProcedure+e.Message+e.StackTrace);
}
}
}
return _DataSet.Tables[0];
}