Results 1 to 2 of 2

Thread: [02/03]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    208

    [02/03]

    create table mytable( country varchar(30), city varchar(30))
    insert into mytable values('Ethiopia','Addis Ababa')
    insert into mytable values('Kenya','Nairobi')
    insert into mytable values('France','Paris')
    insert into mytable values('Japan','Tokyo')
    then i have a text box that receives countries.
    when i try to enter Ethiopia kenya,
    i will expect to get Addis Ababa Kenya,
    if i enter France Japan Ethiopia,
    i will expect to get Paris Tokyo Addis Ababa
    I think all this has done using split if i am not wrong.
    so could you show me how can i select such conditions?
    note that the value of textbox is more than one countries,
    but i know when the value of textbox is one country only.
    dim str as string
    str="select city from mytable where country=' "&textbox1.text&" '"

    my problem when i try to enter two or more countries name at same time.
    your help is crucial 4 me!
    thanks

  2. #2
    Fanatic Member
    Join Date
    Jun 2004
    Location
    All useless places
    Posts
    917

    Re: [02/03]

    From what I understand this can be done only if you have a pre-defined set of list. If that is the case then the following code snippet should work:
    vb Code:
    1. Dim str As String = "KenyaEthiopia"
    2.         Dim flag As Boolean = str.Contains("Kenya")
    3.         Console.WriteLine(flag)
    Otherwise, I do not see how you'll build an inteligence to find out when does one word end and when the next starts.

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