SQL search

  • Wurn
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122
  • Loc: Cape Town

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

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.
  • Wurn
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122
  • Loc: Cape Town

Post 3+ Months Ago

Thx!
  • Wurn
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122
  • Loc: Cape Town

Post 3+ Months Ago

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
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

Can you post what you tried? I'm no expert in MS web development but I can give it a shot.

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 82 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
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.