borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Database with MS access in vb .net)Next Topic (OPENNING FILES) New Topic New Poll Post Reply
AndreaVB Forum : Database : SQL Solved Topic
Poster Message
mique17
Level: Graduate

Registered: 24-05-2006
Posts: 12

icon SQL

im trying to do search in my database using VB, so i try to manipulate my SQL in my code.,but the the result is not what i wanted 2., i want to do searching only by giving a phrase or a word but it will return all datas contaning that keyword or pharse., here's a sample of my code:

Adodc1.RecordSource = "SELECT * FROM myTable WHERE Name = ' " & txtPhrase.Text & " ' "

txtPhrase is the textbox where i used to put my keyword or phrase.,

i want to try putting some wildcards in it but i dont know where to put it.,

for example:
i want to find names begging with "m" in my database

how is it? can you please help me.,   

____________________________
The things you don't like in me are the things that made me true, for those things are natural in me, so its better if you hate for who i am than you'll like me for who i pretend to be.,^_^

24-05-2006 at 02:31 AM
View Profile Send Email to User Show All Posts | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 891
icon Re: SQL

Hi,
The keyword you are looking for is "LIKE" and is used like this:

SELECT * FROM MyTable WHERE Myfield LIKE 'm%'

or, depending on your database it might be LIKE 'm*'

Example:


Adodc1.RecordSource = "SELECT * FROM myTable WHERE Name LIKE '" & txtPhrase.Text & "*' "


Hope this helps,
Kieron


____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

24-05-2006 at 07:55 AM
View Profile Send Email to User Show All Posts | Quote Reply
mique17
Level: Graduate

Registered: 24-05-2006
Posts: 12
icon Re: SQL

thank you so much now i can proceed to my work.,    
now i really love this site., you rock!!!

____________________________
The things you don't like in me are the things that made me true, for those things are natural in me, so its better if you hate for who i am than you'll like me for who i pretend to be.,^_^

25-05-2006 at 02:16 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : SQL Solved Topic
Previous Topic (Database with MS access in vb .net)Next Topic (OPENNING FILES) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder