SQL search

  • Wurn
  • Graduate
  • Graduate
  • User avatar
  • Joined: May 19, 2005
  • Posts: 122
  • Loc: Cape Town
  • Status: Offline

Post October 25th, 2010, 6:23 am

Hi, anyone able to help me create the code for searching my ms access db. Im using MS web developer 2008. Here's my current code which let you search for user name only, I need it to search for surname also, and then I need it to be able to allow the user to type in first letter(s) of a name or surname, eg. "Pet" for "Peter" and/or "J" for all names with starting with "J".

Good tutorials on this will help also. My code

Quote:
SelectCommand="SELECT [name], [surname], [ext], [mobile] FROM [contact] WHERE ([name] = ?)">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="name" PropertyName="Text"
Type="String" />
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 25th, 2010, 6:23 am

  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Joined: May 22, 2004
  • Posts: 3415
  • Loc: Richland, WA
  • Status: Offline

Post October 25th, 2010, 7:09 am

Your going to be look for the "LIKE" clause.

http://www.w3schools.com/sql/sql_like.asp

I believe MS Access uses the asterisk (*) for its wild card though.
#define NULL (::rand() % 2)
  • Wurn
  • Graduate
  • Graduate
  • User avatar
  • Joined: May 19, 2005
  • Posts: 122
  • Loc: Cape Town
  • Status: Offline

Post October 25th, 2010, 7:10 am

Thx!
  • Wurn
  • Graduate
  • Graduate
  • User avatar
  • Joined: May 19, 2005
  • Posts: 122
  • Loc: Cape Town
  • Status: Offline

Post October 26th, 2010, 1:03 am

OK, so I've had a look at the link but cant seem to do what I want.

Anyone able to give me the code I'm after and quickly explain what they did? I think if I could get the user to either type in min of 3 letters of a persons name or surname I would like the code to search the users inputted text.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Joined: May 22, 2004
  • Posts: 3415
  • Loc: Richland, WA
  • Status: Offline

Post October 26th, 2010, 6:57 am

Can you post what you tried? I'm no expert in MS web development but I can give it a shot.
#define NULL (::rand() % 2)

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 236 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.