Results 1 to 4 of 4

Thread: Query Strings - RESOLVED

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2003
    Location
    Georgia
    Posts
    32

    Resolved Query Strings - RESOLVED

    I am coming from a vb6 background so I am new to .net. I am trying to add the value of a combobox in my sql and I use to go

    select * from tbl where id = '" & combobox.text & "'"

    I tried doing this and it states:

    Error 4 Operator '&' is not defined for types 'String' and 'System.Windows.Forms.ComboBox'. C:\Documents and Settings\sodam\My Documents\Visual Studio 2005\Projects\SC_Utility\SC_Utility\frmMain.vb 87 43 SC_Utility

    Thanks for your help
    Shannon
    Last edited by odamsr; Dec 2nd, 2005 at 02:58 PM. Reason: Resolved

  2. #2
    Frenzied Member conipto's Avatar
    Join Date
    Jun 2005
    Location
    Chicago
    Posts
    1,175

    Re: Query Strings

    That code should work - but are you calling it EXACTLY Like that though? Because if you are, ComboBox is a type, not an instance of a combobox. usually you'd see something more like..

    VB Code:
    1. select * from tbl where id = '" & combobox[b]1[/b].text & "'"

    Bill
    Hate Adobe Acrobat? My Codebank Sumbissions - Easy CodeDom Expression evaluator: (VB / C# ) -- C# Scrolling Text Display

    I Like to code when drunk. Don't say you weren't warned.

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: Query Strings

    That's the problem. You are attempting to concatenate a string and an object type, which doesn't work.
    My usual boring signature: Nothing

  4. #4

    Thread Starter
    Member
    Join Date
    Jun 2003
    Location
    Georgia
    Posts
    32

    Re: Query Strings

    Thanks. I made a stupid mistake. Forgot to use combobox.text. I just used me.cbobox

    Thanks
    Shannon

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