Select

ADO DOT NET

Well-known member
Joined
Dec 20, 2006
Messages
156
Code:
                Dim ReadUsers As New OleDb.OleDbCommand("SELECT Email, FirstName, LastName FROM Users WHERE GroupID = " + MyID + "", MyConnection)
                Dim MyReaders As OleDbDataReader = ReadUsers.ExecuteReader
                While MyReaders.Read
                    MsgBox (MyReaders("Email").ToString)
                End While
Hi,
The above code works fine, just I have 1 question:
When I SELECT Email FROM USERS WHERE GroupID = blah
How can I detect that how many fields have been selected?!
Thanks:)
 
[highlight=sql]
SELECT COUNT(*) FROM Users WHERE GroupID = " + MyID + ""
[/highlight]

Although I would avoid string concatenation and use a parametrised query or a stored proc instead.
 
[highlight=sql]
SELECT COUNT(*) FROM Users WHERE GroupID = " + MyID + ""
[/highlight]

Although I would avoid string concatenation and use a parametrised query or a stored proc instead.

You completely misunderstood!
I mean when I use:
SELECT Email, FirstName, LastName FROM Users WHERE GroupID = ...
Then I want to know the number of fields that match this select term and have been selected?
Or there are how many fields that their GroupID = equals = MyID?
 
Back
Top