Visual Basic .NET » Windows Forms
Timeout and DeadLock in SqlDataAdapter.Fill method -- Avinash --


Hello,
I have following GetDataTable method wich will return a DataTable object from given command object.

This is working fine when amount of data is not too much. In case of large data some ting like 60-70 thousand records, the control enters in m_oSqlDa.Fill() method and gives Timeout error when multiple clients are connected to application.
Also some time, when multiple users are connect to same part of screen,
this method generates DeadLock in SQL Server 2000.
As far database and code is concerned there is no explicit locking is used.
Any information in this regard will be very useful.
Thanks.
Avinash

public DataTable GetDataTable(SqlCommand sqlCommand)
{
DataTable odtCommon = new DataTable();

if(m_oConn.State != ConnectionState.Open)
m_oConn.Open();

sqlCommand.Connection = m_oConn;
sqlCommand.CommandType = CommandType.StoredProcedure ;
if (m_bInTransaction)
sqlCommand.Transaction = m_oTrans;

m_oSqlDa.SelectCommand = sqlCommand;

try
{
m_oSqlDa.Fill(odtCommon);
// Return DataTable
return odtCommon;
}
finally
{
if (!m_bInTransaction)
m_oConn.Close();
odtCommon.Dispose();
odtCommon = null;
}

}

-- Avinash --


Hello,
I have following GetDataTable method wich will return a DataTable object from given command object.

This is working fine when amount of data is not too much. In case of large data some ting like 60-70 thousand records, the control enters in

m_oSqlDa.Fill() method and gives Timeout error when multiple clients are connected to application.
Also some time, when multiple users are connect to same part of screen,

this method generates DeadLock in SQL Server 2000.
As far database and code is concerned there is no explicit locking is used.
Any information in this regard will be very useful.
Thanks.
Avinash
public DataTable GetDataTable(SqlCommand sqlCommand)
{
DataTable odtCommon = new DataTable();
if(m_oConn.State != ConnectionState.Open)
m_oConn.Open();
sqlCommand.Connection = m_oConn;
sqlCommand.CommandType = CommandType.StoredProcedure ;
if (m_bInTransaction)
sqlCommand.Transaction = m_oTrans;
m_oSqlDa.SelectCommand = sqlCommand;
try
{
m_oSqlDa.Fill(odtCommon);
// Return DataTable
return odtCommon;
}
finally
{
if (!m_bInTransaction)
m_oConn.Close();
odtCommon.Dispose();
odtCommon = null;
}

-- RamaSrinuA --

HI Avinash,

Use SELECT ... FROM <tableName> WITH(NOLOCK) like this in your Stored procedure.

RamaSrinu A

On 7/12/06, Avinash <avinashpatil1980> wrote:


Hello,
I have following GetDataTable method wich will return a DataTable
object from given command object.

This is working fine when amount of data is not too much. In case of
large data some ting like 60-70 thousand records, the control enters in

m_oSqlDa.Fill() method and gives Timeout error when multiple clients
are connected to application.
Also some time, when multiple users are connect to same part of screen,

this method generates DeadLock in SQL Server 2000.
As far database and code is concerned there is no explicit locking is
used.
Any information in this regard will be very useful.
Thanks.
Avinash
public DataTable GetDataTable(SqlCommand sqlCommand)
{
DataTable odtCommon = new DataTable();
if(m_oConn.State != ConnectionState.Open)
m_oConn.Open();
sqlCommand.Connection = m_oConn;
sqlCommand.CommandType = CommandType.StoredProcedure ;
if (m_bInTransaction)
sqlCommand.Transaction = m_oTrans;
m_oSqlDa.SelectCommand = sqlCommand;
try
{
m_oSqlDa.Fill(odtCommon);
// Return DataTable
return odtCommon;
}
finally
{
if (!m_bInTransaction)
m_oConn.Close();
odtCommon.Dispose();
odtCommon = null;
}
>

--  


Regards,
Rama Srinu A

[Submit Comment]Home