kris_s wrote:
Yes, i know, but if the returned object has range of Int32 than there is no sense convering it. This doesn't resolve my problem.
When the number of rows exceeds maximal value of Int32 I won't be able to correctly count them?
As Walaa said: the GetScalar method returns the value returned from the ADO.NET command's ExecuteScalar method. This means that if you execute it against SqlServer and SqlServer returns an int32, you will get an int32. If it returns a bit, you'll get a boolean. So if you in this case get an int32, SqlServer has returned an int32 on the query.