Bind combobox to sql statement result in VB2005

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • guy

    #1

    Bind combobox to sql statement result in VB2005

    I am able to use the Server Explorer to create a dataset containing tables in my database. I am able
    to bind a table to my combobox and set a filter by including a where clause. But I am unable to
    concat 2 columns as an addition column in the select statement without getting an error. It seems
    that I am restricted to use only the columns of the table.

    How do I bind a combobox to the resultset of a SQL statement?

    Furthermore, I need to sync the contents of a datagrid from the selectedvalue of the combobox. Any
    ideas?
  • RobinS

    #2
    Re: Bind combobox to sql statement result in VB2005

    Post your code (like your query at least), and we may be able to help you.

    Robin S.

    "guy" <guy@hotmail.co mwrote in message
    news:c8a1v2d5ta qbmcqugghp026ck 0ki5f3l1s@4ax.c om...
    >I am able to use the Server Explorer to create a dataset containing tables
    >in my database. I am able
    to bind a table to my combobox and set a filter by including a where
    clause. But I am unable to
    concat 2 columns as an addition column in the select statement without
    getting an error. It seems
    that I am restricted to use only the columns of the table.
    >
    How do I bind a combobox to the resultset of a SQL statement?
    >
    Furthermore, I need to sync the contents of a datagrid from the
    selectedvalue of the combobox. Any
    ideas?

    Comment

    • guy

      #3
      Re: Bind combobox to sql statement result in VB2005

      On Thu, 8 Mar 2007 22:11:52 -0800, "RobinS" <RobinS@NoSpam. yah.nonewrote:
      >Post your code (like your query at least), and we may be able to help you.
      >
      >Robin S.
      >
      The problem has to do with visual programming so the only code is SQL. I tracked down to the Query
      Builder in TableAdapter Config. It seems that the sql parser only recognizes the plus sign (+) as a
      string concatenation operator but this is not portable to other RDBMS that use the ANSI SQL standard
      vertical bars "||" string concatenation operator.

      The following ANSI SQL is not accepted by the TableAdapter Query Builder parser although the
      statement executes properly:

      select sColumn1 || sColumn2 as expr1 from mytable;

      The following SQL works in SQL Server but it is not portable to other RDBMS:
      select sColumn1 + sColumn2 as expr1 from mytable;

      Comment

      • aaron.kempf@gmail.com

        #4
        Re: Bind combobox to sql statement result in VB2005

        huh?

        Im really not sure i've seen that before.. is that mySql?

        I mean do you really think that is ANSI?

        -Aaron




        On Mar 9, 5:58 pm, guy <g...@hotmail.c omwrote:
        On Thu, 8 Mar 2007 22:11:52 -0800, "RobinS" <Rob...@NoSpam. yah.nonewrote:
        Post your code (like your query at least), and we may be able to help you.
        >
        Robin S.
        >
        The problem has to do with visual programming so the only code is SQL. I tracked down to the Query
        Builder in TableAdapter Config. It seems that the sql parser only recognizes the plus sign (+) as a
        string concatenation operator but this is not portable to other RDBMS that use the ANSI SQL standard
        vertical bars "||" string concatenation operator.
        >
        The following ANSI SQL is not accepted by the TableAdapter Query Builder parser although the
        statement executes properly:
        >
        select sColumn1 || sColumn2 as expr1 from mytable;
        >
        The following SQL works in SQL Server but it is not portable to other RDBMS:
        select sColumn1 + sColumn2 as expr1 from mytable;

        Comment

        • aaron.kempf@gmail.com

          #5
          Re: Bind combobox to sql statement result in VB2005

          and for the record; you can always make a 'calculated column' in SQL
          Server

          so you could call this sColumns and set the formula for this to
          sColumn1 + sColumn2
          and then you could bind the crap to the single column

          I love calculated columns; I don't think that very many other vendors
          support this; but I use them ALL the friggin time







          On Mar 9, 5:58 pm, guy <g...@hotmail.c omwrote:
          On Thu, 8 Mar 2007 22:11:52 -0800, "RobinS" <Rob...@NoSpam. yah.nonewrote:
          Post your code (like your query at least), and we may be able to help you.
          >
          Robin S.
          >
          The problem has to do with visual programming so the only code is SQL. I tracked down to the Query
          Builder in TableAdapter Config. It seems that the sql parser only recognizes the plus sign (+) as a
          string concatenation operator but this is not portable to other RDBMS that use the ANSI SQL standard
          vertical bars "||" string concatenation operator.
          >
          The following ANSI SQL is not accepted by the TableAdapter Query Builder parser although the
          statement executes properly:
          >
          select sColumn1 || sColumn2 as expr1 from mytable;
          >
          The following SQL works in SQL Server but it is not portable to other RDBMS:
          select sColumn1 + sColumn2 as expr1 from mytable;

          Comment

          • RobinS

            #6
            Re: Bind combobox to sql statement result in VB2005

            Okay, now I know what you're talking about. I feel your pain. I used Oracle
            in my last app, which uses the ||. But why do you need to use that if you
            are using SQLServer in the background? Or does the strongly typed dataset
            stuff not recognize when the database is non-SQLServer and allow you to do
            different syntax?

            Robin S.
            --------------------------
            "guy" <guy@hotmail.co mwrote in message
            news:er24v21b23 v7ud3ggrui6djjl kpsdtveoq@4ax.c om...
            On Thu, 8 Mar 2007 22:11:52 -0800, "RobinS" <RobinS@NoSpam. yah.none>
            wrote:
            >
            >>Post your code (like your query at least), and we may be able to help
            >>you.
            >>
            >>Robin S.
            >>
            The problem has to do with visual programming so the only code is SQL. I
            tracked down to the Query
            Builder in TableAdapter Config. It seems that the sql parser only
            recognizes the plus sign (+) as a
            string concatenation operator but this is not portable to other RDBMS
            that use the ANSI SQL standard
            vertical bars "||" string concatenation operator.
            >
            The following ANSI SQL is not accepted by the TableAdapter Query Builder
            parser although the
            statement executes properly:
            >
            select sColumn1 || sColumn2 as expr1 from mytable;
            >
            The following SQL works in SQL Server but it is not portable to other
            RDBMS:
            select sColumn1 + sColumn2 as expr1 from mytable;
            >

            Comment

            • guy

              #7
              Re: Bind combobox to sql statement result in VB2005

              On Sat, 10 Mar 2007 10:14:33 -0800, "RobinS" <RobinS@NoSpam. yah.nonewrote:
              >Okay, now I know what you're talking about. I feel your pain. I used Oracle
              >in my last app, which uses the ||. But why do you need to use that if you
              >are using SQLServer in the background? Or does the strongly typed dataset
              >stuff not recognize when the database is non-SQLServer and allow you to do
              >different syntax?
              >
              >Robin S.
              I need to stick with portable code so using the plus sign (+) for concatenation in SQL is not an
              option. What is the work around in VB2005?

              Comment

              • RobinS

                #8
                Re: Bind combobox to sql statement result in VB2005

                "guy" <guy@hotmail.co mwrote in message
                news:in26v2h6gj 3rplfigjilurp08 95c5896je@4ax.c om...
                On Sat, 10 Mar 2007 10:14:33 -0800, "RobinS" <RobinS@NoSpam. yah.none>
                wrote:
                >
                >>Okay, now I know what you're talking about. I feel your pain. I used
                >>Oracle
                >>in my last app, which uses the ||. But why do you need to use that if you
                >>are using SQLServer in the background? Or does the strongly typed dataset
                >>stuff not recognize when the database is non-SQLServer and allow you to
                >>do
                >>different syntax?
                >>
                >>Robin S.
                >
                I need to stick with portable code so using the plus sign (+) for
                concatenation in SQL is not an
                option. What is the work around in VB2005?
                It looks like you're SOL. From what I can find, that is the only
                concatenation symbol in SQLServer. You could try posting your question to
                microsoft.publi c.sqlserver.pro gramming and see if they have any other
                ideas.

                Robin S.


                Comment

                • aaron.kempf@gmail.com

                  #9
                  Re: Bind combobox to sql statement result in VB2005

                  maybe you could write a function and call it ||

                  Select FirstName + dbo.|| + LastName

                  ROFLMAO


                  On Mar 11, 10:55 am, "RobinS" <Rob...@NoSpam. yah.nonewrote:
                  "guy" <g...@hotmail.c omwrote in message
                  >
                  news:in26v2h6gj 3rplfigjilurp08 95c5896je@4ax.c om...
                  >
                  >
                  >
                  >
                  >
                  On Sat, 10 Mar 2007 10:14:33 -0800, "RobinS" <Rob...@NoSpam. yah.none>
                  wrote:
                  >
                  >Okay, now I know what you're talking about. I feel your pain. I used
                  >Oracle
                  >in my last app, which uses the ||. But why do you need to use that if you
                  >are using SQLServer in the background? Or does the strongly typed dataset
                  >stuff not recognize when the database is non-SQLServer and allow you to
                  >do
                  >different syntax?
                  >
                  >Robin S.
                  >
                  I need to stick with portable code so using the plus sign (+) for
                  concatenation in SQL is not an
                  option. What is the work around in VB2005?
                  >
                  It looks like you're SOL. From what I can find, that is the only
                  concatenation symbol in SQLServer. You could try posting your question to
                  microsoft.publi c.sqlserver.pro gramming and see if they have any other
                  ideas.
                  >
                  Robin S.- Hide quoted text -
                  >
                  - Show quoted text -

                  Comment

                  • aaron.kempf@gmail.com

                    #10
                    Re: Bind combobox to sql statement result in VB2005

                    you need to stick with 'portable code'
                    THEN DONT USE ORACLE PROPIETARY _CRAP_ DOG






                    On Mar 10, 12:49 pm, guy <g...@hotmail.c omwrote:
                    On Sat, 10 Mar 2007 10:14:33 -0800, "RobinS" <Rob...@NoSpam. yah.nonewrote:
                    Okay, now I know what you're talking about. I feel your pain. I used Oracle
                    in my last app, which uses the ||. But why do you need to use that if you
                    are using SQLServer in the background? Or does the strongly typed dataset
                    stuff not recognize when the database is non-SQLServer and allow you to do
                    different syntax?
                    >
                    Robin S.
                    >
                    I need to stick with portable code so using the plus sign (+) for concatenation in SQL is not an
                    option. What is the work around in VB2005?

                    Comment

                    • aaron.kempf@gmail.com

                      #11
                      Re: Bind combobox to sql statement result in VB2005

                      'I need to use portbale code' so can you please make SQL Server work
                      like this Oracle _CRAP_

                      Oracle is obsolete dog.. check out www.olapreport.com

                      if you're not usign Olap you're shit outta luck and you're roadkill

                      OLAP solves every database performance problem in the world



                      On Mar 10, 12:49 pm, guy <g...@hotmail.c omwrote:
                      On Sat, 10 Mar 2007 10:14:33 -0800, "RobinS" <Rob...@NoSpam. yah.nonewrote:
                      Okay, now I know what you're talking about. I feel your pain. I used Oracle
                      in my last app, which uses the ||. But why do you need to use that if you
                      are using SQLServer in the background? Or does the strongly typed dataset
                      stuff not recognize when the database is non-SQLServer and allow you to do
                      different syntax?
                      >
                      Robin S.
                      >
                      I need to stick with portable code so using the plus sign (+) for concatenation in SQL is not an
                      option. What is the work around in VB2005?

                      Comment

                      • aaron.kempf@gmail.com

                        #12
                        Re: Bind combobox to sql statement result in VB2005

                        'this is not portable to other RDBMS'

                        please give examples.. are you only referring to Oracle?

                        Oracle hasn't been competitive for 5 years www.olapreport.com/market.htm

                        Oracle has less than 5% marketshare dog; don't bitch about making SQL
                        act like Oracle dude.. Oracle is for fucking retards that are stuck in
                        the 90s





                        On Mar 9, 6:58 pm, guy <g...@hotmail.c omwrote:
                        On Thu, 8 Mar 2007 22:11:52 -0800, "RobinS" <Rob...@NoSpam. yah.nonewrote:
                        Post your code (like your query at least), and we may be able to help you.
                        >
                        Robin S.
                        >
                        The problem has to do with visual programming so the only code is SQL. I tracked down to the Query
                        Builder in TableAdapter Config. It seems that the sql parser only recognizes the plus sign (+) as a
                        string concatenation operator but this is not portable to other RDBMS that use the ANSI SQL standard
                        vertical bars "||" string concatenation operator.
                        >
                        The following ANSI SQL is not accepted by the TableAdapter Query Builder parser although the
                        statement executes properly:
                        >
                        select sColumn1 || sColumn2 as expr1 from mytable;
                        >
                        The following SQL works in SQL Server but it is not portable to other RDBMS:
                        select sColumn1 + sColumn2 as expr1 from mytable;

                        Comment

                        Working...