|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem with access database, and VB .NETHi guys I am trying to use select Query with Like operator
Select DrugName from Stock where (DrugName LIKE '*s*') This query works in MS-Access Query option and returns some records, but when I run it through VB .net programm it dosen't return any result nither it gives any error. What could be the problem plz. help Try changing the Sql to
Select DrugName from Stock where DrugName LIKE '%s%' Show quoteHide quote "amit" <amit.mural***@gmail.com> wrote in message news:1159957895.583596.216140@i3g2000cwc.googlegroups.com... > Hi guys I am trying to use select Query with Like operator > > Select DrugName from Stock where (DrugName LIKE '*s*') > > This query works in MS-Access Query option and returns some records, > but when I run it through VB .net programm it dosen't return any result > nither it gives any error. > > What could be the problem plz. help > Use % instead of *....
-- "amit" <amit.mural***@gmail.com> a écrit dans le message de news: 1159957895.583596.216***@i3g2000cwc.googlegroups.com...Show quoteHide quote > Hi guys I am trying to use select Query with Like operator > > Select DrugName from Stock where (DrugName LIKE '*s*') > > This query works in MS-Access Query option and returns some records, > but when I run it through VB .net programm it dosen't return any result > nither it gives any error. > > What could be the problem plz. help > Hello
Thanks for the reply I tried using '%s%' instade of '*s*' There are two records starting with 's' but is returns only one. Thanks On 4 Oct 2006 04:43:58 -0700, "amit" <amit.mural***@gmail.com> wrote: ¤ Hello¤ ¤ Thanks for the reply ¤ ¤ I tried using '%s%' instade of '*s*' ¤ ¤ There are two records starting with 's' but is returns only one. I would double-check your results. I'm not sure how you are displaying the data in order to verify that only one instance is being returned, but there is no reason it would work for one row and not another. Also, I would remove the parentheses around your WHERE statement. They are unnecessary. Paul ~~~~ Microsoft MVP (Visual Basic) Hello Paul
I double checked it, I tried the same with %d%, there are 5 records starting with d it shows only 4... It eleminates the first maching record in every case, what could be the reason? Plz help The code is ocmEmpresas.CommandText = "Select DrugName from Stock where (DrugName LIKE '%" + TextBox2.Text.Trim() + "%')" Thanks Paul Clement wrote: Show quoteHide quote > On 4 Oct 2006 04:43:58 -0700, "amit" <amit.mural***@gmail.com> wrote: > > ¤ Hello > ¤ > ¤ Thanks for the reply > ¤ > ¤ I tried using '%s%' instade of '*s*' > ¤ > ¤ There are two records starting with 's' but is returns only one. > > I would double-check your results. I'm not sure how you are displaying the data in order to verify > that only one instance is being returned, but there is no reason it would work for one row and not > another. > > Also, I would remove the parentheses around your WHERE statement. They are unnecessary. > > > Paul > ~~~~ > Microsoft MVP (Visual Basic) On 5 Oct 2006 02:14:06 -0700, "amit" <amit.mural***@gmail.com> wrote: ¤ Hello Paul¤ ¤ I double checked it, ¤ I tried the same with %d%, there are 5 records starting with d it shows ¤ only 4... ¤ It eleminates the first maching record in every case, what could be the ¤ reason? ¤ Plz help ¤ ¤ The code is ¤ ¤ ocmEmpresas.CommandText = "Select DrugName from Stock where (DrugName ¤ LIKE '%" + TextBox2.Text.Trim() + "%')" ¤ How are you viewing the data? Did you check all the rows in the Recordset? Paul ~~~~ Microsoft MVP (Visual Basic) "amit" <amit.mural***@gmail.com> wrote in message What error do you get?news:1159957895.583596.216140@i3g2000cwc.googlegroups.com... > Hi guys I am trying to use select Query with Like operator > > Select DrugName from Stock where (DrugName LIKE '*s*') > > This query works in MS-Access Query option and returns some records, > but when I run it through VB .net programm it dosen't return any result > nither it gives any error. > > What could be the problem plz. help Can you show your code?
You're good if you can answer this one.....
.NET 2 recommended books? Sending email with attachments Open folders to process files automatically Office application object problem Datetimepicker - just getting the data part ComboBox.Items.Clear() How to convert code snipped from VB6 to Visual Studio 2005/VB (VB7?) Extracting icon from file: most efficient method? Changing Printer's default paper |
|||||||||||||||||||||||