Lemon Posted March 20, 2004 Posted March 20, 2004 Hi, for example i have a query like this: MyCommand = New OleDbCommand("SELECT id FROM games", MyConnection) Now i need to know how i can get the number of rows that is selected, so an integer number. And my second question is. A structual problem :) If i have multible rows that are selected then i do while MyCommand.read .. End While Now what is the best way to get the values if i only SELECT 1 row? Quote
betrl8thanever Posted March 21, 2004 Posted March 21, 2004 Hi, for example i have a query like this: MyCommand = New OleDbCommand("SELECT id FROM games", MyConnection) Now i need to know how i can get the number of rows that is selected, so an integer number. And my second question is. A structual problem :) If i have multible rows that are selected then i do while MyCommand.read .. End While Now what is the best way to get the values if i only SELECT 1 row? MyCommand = New OleDbCommand("SELECT Count(*) FROM games", MyConnection) Quote "In the immortal words of Socrates, who said "' I drank what?!'"
Moderators Robby Posted March 21, 2004 Moderators Posted March 21, 2004 Lemon are you talking about 'selected' items in a Datagrid? Quote Visit...Bassic Software
amir100 Posted March 21, 2004 Posted March 21, 2004 To Lemon: How 'bout inserting the result from executing the "MyCommand = ..." into a dataset, then you can get the number of rows using: Dim num as Integer = MyDataSet.rows.Count; ~kindOfForgotTheMethodToUse :) Quote Amir Syafrudin
Lemon Posted March 21, 2004 Author Posted March 21, 2004 Do you have a small tutorial how to use datasets? Quote
Moderators Robby Posted March 21, 2004 Moderators Posted March 21, 2004 http://samples.gotdotnet.com/QuickStart/winforms/default.aspx?url=/quickstart/winforms/doc/DataAccessPlaceHolder.aspx Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.