SQLCommand Timeout expires in code but not in Query Analyzer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using VB.NET to query a SQL 2000 database through a view.

The query I am attempting is a SELECT COUNT query. When I run the query in
SQL Analyzer, it returns the count of around 3000 records in 1 second, but
when I run it in code with the sqlCommand object in code, with the same 2
parameters, it times out.

I tried increasing the CommandTimeout to 90 seconds and it still times out.

Has anyone experienced this? What am I doing wrong?
 
I just went back and tried it with an OleDB command object and it returns
just about as fast as Query Analyzer did (no exception), go figure ?

Is this is a bug or am I ?
 
I cant do a trace at the moment because it's a production server and i am not
the administrator. However, yes it is a simple executeScalar. I'm
investigating it right now.
 
I just performed another test using the sqldataadapter and the
oledbdataadapter and the sqldataadapter timed out and the oledbdataadapter.

At first, sqldataadapter failed and the oledbdataadapter passed (same
timeout value).
Now they are both failing and I am back to where I started.

Can someone please tell me why this is timing out?
It's not a ExecuteScalar anymore. It is attempting to SELECT a dataset of
about 3000 rows from a view on a SQL server.
 
Back
Top