Re: Close - No Dispose - Memory Leak?
- From: "Darren" <darren.pruitt@xxxxxxxxx>
- Date: 10 Jan 2006 08:33:22 -0800
Gentlemen thank you for your responses, it was very informative. I
think that William identified for me what I needed to know. After
profiling the application I found that there were a lot of long lived
objects and, surprisingly, there were a lot more String objects then
ADO.NET objects.
So I will keep beating the system and try to find out why it is
thrashing the server.
FYI, here is how I would prefer to do the data access:
public static string SomeFunction(int someId)
{
string commandText = "storedProcName";
SqlParameter[] param = new SqlParameter[1];
param[0] = new SqlParameter("@some_id", SqlDbType.Int, 4);
param[0].Value = someId;
string returnValue = string.Empty;
using(SqlConnection conn = new
SqlConnection(AStaticConnectionString))
{
// Using the Micorsoft SqlHelper Object
returnValue = SqlHelper.ExecuteScalar(
conn
,CommandType.StoredProcedure
, commandText
, param).ToString();
}
return returnValue;
}
.
- References:
- Close - No Dispose - Memory Leak?
- From: darren . pruitt
- Close - No Dispose - Memory Leak?
- Prev by Date: Sql Sevrer not updated after copying DataRows
- Next by Date: Re: TableAdapter Garbage
- Previous by thread: Re: Close - No Dispose - Memory Leak?
- Next by thread: Weird IDbCommand.Parameters[] design?
- Index(es):
Relevant Pages
|