Results 1 to 8 of 8

Thread: query string not working right

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    query string not working right

    I've got this string:
    VB Code:
    1. SQLCMD.CommandText = "select usoc_code, usoc_description " & _
    2.      "from features " & _
    3.      "WHERE telephone_number = '" & RemoveHyphen(telephone) & "' " & _
    4.       "and (usoc_code = 'eamntc' or " & _
    5.       "usoc_code = 'ramntc' or " & _
    6.       "usoc_code = 'ranmntc' or " & _
    7.       "usoc_code = 'bamntc' or " & _
    8.       "usoc_code = 'baiw' or " & _
    9.       "usoc_code = 'banmntc') "

    I can run that in Query Analyzer and it works BUT when used in my app, the dataReader doesn't get populated meaning (to me) the query doesn't pass any of the 'or's' . One thing to note is that when I take out the or's, I get back data.

    is there something wrong with the syntax or is there a limitation to a datareader I don't know about?

    also, the data in the reader is going to the statement here:
    VB Code:
    1. reader = SQLCMD.ExecuteReader
    2.         reader.Read()
    3.  
    4.         While reader.Read
    5.  
    6.             MainForm.Ticketing.tab_0_lstMaintOptions.Items.Add(reader.Item("usoc_code") & " - " & reader.Item("usoc_description"))
    7.  
    8.         End While
    9.  
    10.         MainForm.Ticketing.tab_0_lstMaintOptions.Update()
    Last edited by Andy; May 5th, 2004 at 10:22 AM.

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