Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2006
    Posts
    3

    Unanswered: Problem to supress wild card character '*' in a query

    Hi,

    I am stuck with a problem let me first explain that in detail.
    I am working on a application which is using VB as front end and MS-Excess as backend.

    Now i am having a form in which their is a text box "text1" text box may contain only 0-9,'.'.Also their are 4 options 1) Equal, 2)contains , 3)starts with , 4) ends with so the corresponding queryes are


    So my query's are:-
    1)select * from table_name where col = 'text1.text'
    2)select * from table_name where col Like & "'*" & text1.text & "*''
    3)select * from table_name where col Like ''text1.text & "*''
    4)select * from table_name where col Like "'*" & text1.text'''

    But now client has raised a request to allow '*' also in textbox "text1"
    so now i am facing a problem.only the first query is running correctly & rest of the queries is using * as wild card charcter and they are displaying records like "3600" but i want only '*60066' sort of records i know that "*' is replased by ant string ,can anybody suggest me how to supress wild card in VB code where we are using that in a sql query.

    Thanks in advance
    Pragya
    Last edited by pragya_tiwari2001; 11-03-06 at 06:05.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Moved to VB forum.

    Step 1 would be attempt to persuade them not to do this if at all avoidable.
    Failing that, step 2 would be something like:
    Code:
    "select * 
    from table_name 
    where col Like '' & REPLACE(text1.text, "*", "[*]") & "*''
    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Nov 2006
    Posts
    3

    Unhappy Problem in supressing '*' in select statement

    hello
    I tried that suggestion you have given but its not working actually i am making a formula and passing it top crystal report
    and the final expression is when printed in debug mode:-

    psformula = {Billing.CALLENDTIME} = Date(2006, 11, 3) AND (Time({Billing.CALLENDTIME}) >= Time(0, 0, 0) AND Time({Billing.CALLENDTIME}) <= Time(23, 59, 59)) AND ({Billing.CALLINGPARTYE164ADDRESS} Like '[*]600*' OR {Billing.CALLEDPARTYE164ADDRESS} Like '[*]600*')

    Actually its supposed to display all records withinn the date limits and starting with "*600" thats my requirement...

    can you suggest me what should i do?

    Thanks
    Pragya

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I don't know crystal reports so you may need to post there - let me know if you want me to move the thread.

    The key to problem solving is to strip the problem down to it's barest essentials. Remove everything but the thing you are testing (the Like '[*]600*' bit). Check that this bit works - if so then you have another problem. If not then it is probably something to do with Crystal Reports syntax.

    Also - you will need to post more details than "it didn't work". Were there erros? If so - what? Did it return any results? If so, what can you deduce from them - is there a pattern? etc. - remember that we cannot see your screen.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Nov 2006
    Posts
    3

    Red face Not Able to access data starting with *

    Hi ,

    Actually i am not getting any error ...
    the crystal report is coming with no data .
    But if i execute the same query in excess '[*]600' it fetches all *600 records
    I am really stuck with this and unable to proceed furthur ...
    can you please help me more

    if you want to put this issue in any forum plese do the needfull..

    Thanks in advance
    Pragya

  6. #6
    Join Date
    Jun 2005
    Posts
    61

    Talking hi try this plz

    hi i
    u have to wirte it like this
    'see the select here
    select * from tabel_name where Col like '%" & Text1.Text & "%'

    but when u use the like it must be like this '%" & Text1.Text & "%'

    its work correctly with me i will write what i wrote in my project

    rs1.Open "select * from OrderFolo where OrderNo like '%" & Text1.Text & "%' order by OrderNo;", db1, adOpenDynamic, adLockOptimistic
    Last edited by Sam76; 11-06-06 at 04:44.
    Sami Al Damiri ...

Posting Permissions

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