Results 1 to 5 of 5

Thread: Sql statement Issue

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Sql statement Issue

    hi friends ,
    the following query is working very fine .because i am getting rows when run
    the following query in query analyzer.
    Code:
    SELECT IC_Itembarcode.itemID, IC_Itembarcode.Barcode, IC_Itembarcode.Serial1, IC_Itembarcode.Serial2, IC_Itembarcode.Serial3, IC_Itembarcode.Serial4, IC_Itembarcode.SerialCombination, IC_ItemID.L1Description, IC_ItemID.L2Description, IC_ItemID.ExtraL1Description, IC_ItemID.ExtraL2Description
    FROM IC_ItemID INNER JOIN IC_Itembarcode 
    ON IC_ItemID.itemID=IC_Itembarcode.itemID 
    WHERE IC_iTEMID.ITEMID LIKE 'ADA-Mens-Accss-B%'
    but when i change the where clause in my programme .because i want to restrict the rows on the basis of txtItemSearch .to get all the corresponding detail from ic_temid & ic_tembarcode tables.but the following query does not work.i am sure error is somewhere in where
    clause .but i am unable to find it .let me know please .thx in advance .
    Code:
     SELECT IC_Itembarcode.itemID, IC_Itembarcode.Barcode, IC_Itembarcode.Serial1, IC_Itembarcode.Serial2, IC_Itembarcode.Serial3, IC_Itembarcode.Serial4, IC_Itembarcode.SerialCombination, IC_ItemID.L1Description, IC_ItemID.L2Description, IC_ItemID.ExtraL1Description, IC_ItemID.ExtraL2Description
    FROM IC_ItemID INNER JOIN IC_Itembarcode 
    ON IC_ItemID.itemID=IC_Itembarcode.itemID 
    WHERE IC_ItemID.itemid  Like ' & Trim(txtItemSearch.Text) &% '

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Sql statement Issue

    "WHERE IC_ItemID.itemid Like '" & Trim(txtItemSearch.Text) & "%'"
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Sql statement Issue

    Thread moved to the 'Database Development' forum (the 'VB6' forum is only meant for questions which don't fit in more specific forums)

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Sql statement Issue

    normally if it is string then we are doing filtervariable inside the ' '.but i did not understand .why " " is also needed here .

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Sql statement Issue

    Quote Originally Posted by firoz.raj View Post
    normally if it is string then we are doing filtervariable inside the ' '.but i did not understand .why " " is also needed here .
    If you Debug.Print your sql statement, you will see why
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width