Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

               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:)

Posted
[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?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...