Get me a count....
-
I m really speechless on this..
string strQuery = "Select * from tblExtension where UserType = " + _UserType; int _Count = 0; OleDbDataReader drExtension = OleDbHelper.ExecuteReader(Utility.ConnectionString, CommandType.Text, strQuery); using(drExtension) { while(drExtension.Read()) { ++_Count; } } return _Count;
ny comment??Vikas Salvi Programmer Analyst
Version 1.0 probably used a DataAdapter to Fill a DataTable and then counted the Rows. This is an improvement.
-
Version 1.0 probably used a DataAdapter to Fill a DataTable and then counted the Rows. This is an improvement.
using a Count(*) query is much simple n straightforward i suppose :-D
Vikas Salvi Programmer Analyst
-
using a Count(*) query is much simple n straightforward i suppose :-D
Vikas Salvi Programmer Analyst
And depending upon the database, count(ROWID) might be even better. :)
Chris Meech I am Canadian. [heard in a local bar]
-
I m really speechless on this..
string strQuery = "Select * from tblExtension where UserType = " + _UserType; int _Count = 0; OleDbDataReader drExtension = OleDbHelper.ExecuteReader(Utility.ConnectionString, CommandType.Text, strQuery); using(drExtension) { while(drExtension.Read()) { ++_Count; } } return _Count;
ny comment??Vikas Salvi Programmer Analyst
Check the MFC docs for CRecordset. They specifically advise that the record count isn't known until you've scrolled to the last record and then recommend you do just that if you need the count. A colleague, many years ago, followed that advice. It worked fine on his test databases but when it hit the real world and a recordset containing 3 million records it didn't work quite so well. Interestingly enough, the customer put up with the shocking performance (> 40 minutes for a form refresh). Go figure!
Rob Manderson My bloghttp://robmanderson.blogspot.com[^]
-
using a Count(*) query is much simple n straightforward i suppose :-D
Vikas Salvi Programmer Analyst
Well, yeah, but we have to save that for the next version... if anyone complains about performance that is. Or, if we're very lucky, we'll get to buy new servers to improve performance, and that makes us very happy. :-D
-
Check the MFC docs for CRecordset. They specifically advise that the record count isn't known until you've scrolled to the last record and then recommend you do just that if you need the count. A colleague, many years ago, followed that advice. It worked fine on his test databases but when it hit the real world and a recordset containing 3 million records it didn't work quite so well. Interestingly enough, the customer put up with the shocking performance (> 40 minutes for a form refresh). Go figure!
Rob Manderson My bloghttp://robmanderson.blogspot.com[^]
Rob Manderson wrote:
Interestingly enough, the customer put up with the shocking performance (> 40 minutes for a form refresh). Go figure!
Now that's the true WTF. :laugh:
-- You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
-
Check the MFC docs for CRecordset. They specifically advise that the record count isn't known until you've scrolled to the last record and then recommend you do just that if you need the count. A colleague, many years ago, followed that advice. It worked fine on his test databases but when it hit the real world and a recordset containing 3 million records it didn't work quite so well. Interestingly enough, the customer put up with the shocking performance (> 40 minutes for a form refresh). Go figure!
Rob Manderson My bloghttp://robmanderson.blogspot.com[^]
Of course a good way to speed that up was to use the MoveLast method after the recordset was opened. The count call would then be really responsive, but you'd be scratching your head over why was the count always 2. :rolleyes:
Chris Meech I am Canadian. [heard in a local bar]
-
I m really speechless on this..
string strQuery = "Select * from tblExtension where UserType = " + _UserType; int _Count = 0; OleDbDataReader drExtension = OleDbHelper.ExecuteReader(Utility.ConnectionString, CommandType.Text, strQuery); using(drExtension) { while(drExtension.Read()) { ++_Count; } } return _Count;
ny comment??Vikas Salvi Programmer Analyst
It verifies whether SQLServer is doing a correct job or not. :-D
Vasudevan Deepak Kumar Personal Homepage Tech Gossips
-
I m really speechless on this..
string strQuery = "Select * from tblExtension where UserType = " + _UserType; int _Count = 0; OleDbDataReader drExtension = OleDbHelper.ExecuteReader(Utility.ConnectionString, CommandType.Text, strQuery); using(drExtension) { while(drExtension.Read()) { ++_Count; } } return _Count;
ny comment??Vikas Salvi Programmer Analyst
-
I m really speechless on this..
string strQuery = "Select * from tblExtension where UserType = " + _UserType; int _Count = 0; OleDbDataReader drExtension = OleDbHelper.ExecuteReader(Utility.ConnectionString, CommandType.Text, strQuery); using(drExtension) { while(drExtension.Read()) { ++_Count; } } return _Count;
ny comment??Vikas Salvi Programmer Analyst
Thats why I always be in work, people like that create work for everyone. Oh the inexperienced should be allowed to develop commercial code.
Roger Irrelevant "he's completely hatstand"
-
Check the MFC docs for CRecordset. They specifically advise that the record count isn't known until you've scrolled to the last record and then recommend you do just that if you need the count. A colleague, many years ago, followed that advice. It worked fine on his test databases but when it hit the real world and a recordset containing 3 million records it didn't work quite so well. Interestingly enough, the customer put up with the shocking performance (> 40 minutes for a form refresh). Go figure!
Rob Manderson My bloghttp://robmanderson.blogspot.com[^]
Yes but it should not apply if the query uses "count(*)" becuase the sql server will do the "counting" and return 1 row with the result. Mauro Leggieri.
-
I m really speechless on this..
string strQuery = "Select * from tblExtension where UserType = " + _UserType; int _Count = 0; OleDbDataReader drExtension = OleDbHelper.ExecuteReader(Utility.ConnectionString, CommandType.Text, strQuery); using(drExtension) { while(drExtension.Read()) { ++_Count; } } return _Count;
ny comment??Vikas Salvi Programmer Analyst
Did he use the wrong incantations?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
George Orwell, "Keep the Aspidistra Flying", Opening words -
I m really speechless on this..
string strQuery = "Select * from tblExtension where UserType = " + _UserType; int _Count = 0; OleDbDataReader drExtension = OleDbHelper.ExecuteReader(Utility.ConnectionString, CommandType.Text, strQuery); using(drExtension) { while(drExtension.Read()) { ++_Count; } } return _Count;
ny comment??Vikas Salvi Programmer Analyst
Reminds me of one I saw. To alphabetically sort the ASCII data in a table the moron read the relevant field into a fixed length string array and then he sorted the array. And guess what the management did to him? He was promoted to team leader eventually! I kid you not.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for - in order to get to the job you need to pay for the clothes and the car, and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
-
Reminds me of one I saw. To alphabetically sort the ASCII data in a table the moron read the relevant field into a fixed length string array and then he sorted the array. And guess what the management did to him? He was promoted to team leader eventually! I kid you not.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for - in order to get to the job you need to pay for the clothes and the car, and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
Ted Ferenc wrote:
And guess what the management did to him? He was promoted to team leader eventually!
:wtf::omg:
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->ßRÅhmmÃ<-·´¯`·.
-
Ted Ferenc wrote:
And guess what the management did to him? He was promoted to team leader eventually!
:wtf::omg:
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->ßRÅhmmÃ<-·´¯`·.
The sad thing was the Software Manager, I was going to run a new branch the firm opened so they needed a team leader, my comment was make anybody team leader except him, even the cleaning lady would be a better choice. I did state that within 6 months he would have totally screwed up the work I had done in making the department function at least tolerably well. In 6 months I was proved correct, what happened to him? He left, as he was a team leader, he got a better team leaders job elsewhere!
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for - in order to get to the job you need to pay for the clothes and the car, and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
-
Rob Manderson wrote:
Interestingly enough, the customer put up with the shocking performance (> 40 minutes for a form refresh). Go figure!
Now that's the true WTF. :laugh:
-- You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
add a little spinny thing while it refreshes... they'll wait for hours :)
-
Well, yeah, but we have to save that for the next version... if anyone complains about performance that is. Or, if we're very lucky, we'll get to buy new servers to improve performance, and that makes us very happy. :-D
The gay guy that rated your post with a 2, obviously didn't catch the sarcasm in it... Some things are too subtle I guess ;P
Asynchronously daydreaming...
-
Did he use the wrong incantations?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
George Orwell, "Keep the Aspidistra Flying", Opening words -
Well, yeah, but we have to save that for the next version... if anyone complains about performance that is. Or, if we're very lucky, we'll get to buy new servers to improve performance, and that makes us very happy. :-D
-
Gold Canyon, AZ ... where OpenSource means far too much of a reduction in profit margins! :)
Alright, who are you and how do you know where I live? :~