sql server - Why do I get a Timeout Expired error running this query? -


I am using ODBC to SQL Server 2008 to this query. If I end part (or Li. Diaitiajianeted> = (...)) takes me so do not give me the error ... but I can run it in Ssms fine.

  SELECT COUNT (*) to dbo.POITEMST li WHERE (? NULL or li.DATEGENERATED & gt; =?) And (? IS NULL or (li.DATEGENERATED & gt; = (select MAX (t.DATEGENERATED) from dbo) 

StartDateParam.ParameterName = "StartDate"; StartDateParam.Value = (StartDate.HasValue? (object) StartDate.Value: (object) (new Dinanktaim ( 1753, 2, 2))); cmd.Parameters.Add (startDateParam); StartDateParam = Simdikkret parameter (); StartDateParam.ParameterName = "StartDate"; StartDateParam.Value = (StartDate.HasValue? (object) StartDate.Value (object) (new Dinanktaim (1753, 2, 2))); cmd.Parameters.Add (startDateParam); Dibeepirametr Armbproparam = CMD. Kreet Pirametr (); StartPoParam.ParameterName = "StartP O "; StartPoParam.DbType = DBType.String; StartPoParam.Value = (string.IsNullOrEmpty) (Object) DBNull.Value: (Object) StartPurchaseOrder; cmd.Parameters.Add (startPoParam); StartPoParam = CMD. CretePamator (); StartPoParam.ParameterName = "StartPO"; StartPoParam.DbType = DbType.String; StartPoParam.Value = (string.IsNullOrEmpty (StartPurchaseOrder)? (Object) DBNull.Value: (object) StartPurchaseOrder); Cmd.Parameters.Add (startPoParam); Edit: These dates are only there because I was trying to find out ... it was passing in the debbulo before, if there was no start date.

Partition and win start with T-SQL with hard-coded values, both tap and non- Start with the null simple question and check the query scheme in each step. You are indicated that you have indexing problems, etc. Again, come back to the code.

More schema information - It is difficult to help a lot with a query without table layout, index, etc.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -