Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi

I have the next code:

cmdSelect = New SqlCommand( "Select au_id, au_lname, phone From Authors Order by au_lname", conPubs ).

I want to select and view a specific au_lname, let's say 'Green'.

What do i have to write? I tried the next sentence:

cmdSelect = New SqlCommand( "Select au_id, au_lname, phone From Authors Order by au_lname WHERE au_lname ="'Green', conPubs )

There is an error:')' expected.

Someone can help me?

Thank's.

Posted

I can see 2 things wrong here...

 

Your WHERE clause has to be before your ORDER BY clause. Also, 'Green' needs to be inside the quotes with the rest of your statement...

 

i.e. "Select au_id, au_lname, phone From Authors WHERE au_lname = 'Green' Order by au_lname"

 

HTH

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...