Datasource from string

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

    Datasource from string

    Hi

    Is it possible to create a datasource for dataview control for an sql
    string?

    Thanks

    Regards


  • Cor Ligthert[MVP]

    #2
    Re: Datasource from string

    John,

    A dataview is not a control, it is a view on the datatable.

    Cor


    "John" <info@nospam.in fovis.co.ukschr eef in bericht
    news:OqCeyuJiIH A.5160@TK2MSFTN GP05.phx.gbl...
    Hi
    >
    Is it possible to create a datasource for dataview control for an sql
    string?
    >
    Thanks
    >
    Regards
    >

    Comment

    • =?Utf-8?B?anAybXNmdA==?=

      #3
      RE: Datasource from string

      John,

      Not really. You need to create a new datasource that uses your sql string:

      Dim sql as String = "SELECT * FROM Table1"
      Dim con as String = "Data Source=Northwin d;Initial Catalog=Table1; Integrated
      Security=True"
      Dim ds as DataSource = new DataSource(sql, con)

      The code above is untested, though. I think it needs the sql connection
      string, but I could be mistaken.

      Hope that helps!

      "John" wrote:
      Hi
      >
      Is it possible to create a datasource for dataview control for an sql
      string?
      >
      Thanks
      >
      Regards
      >
      >
      >

      Comment

      • John

        #4
        Re: Datasource from string

        Sorry I meant gridvview.

        "Cor Ligthert[MVP]" <notmyfirstname @planet.nlwrote in message
        news:626D5782-279F-4348-99E0-7643314C1CA3@mi crosoft.com...
        John,
        >
        A dataview is not a control, it is a view on the datatable.
        >
        Cor
        >
        >
        "John" <info@nospam.in fovis.co.ukschr eef in bericht
        news:OqCeyuJiIH A.5160@TK2MSFTN GP05.phx.gbl...
        >Hi
        >>
        >Is it possible to create a datasource for dataview control for an sql
        >string?
        >>
        >Thanks
        >>
        >Regards
        >>
        >

        Comment

        • Patrice

          #5
          Re: Datasource from string

          Not sure though what you meant ? A string is just a string, you have to
          execute the Sql statement that is stored into this string to produce a
          result that can then be binded to a gridview...

          Search google for gridview/databind or elaborate a bit about what you are
          trying to do (are you looking for SqlDataSource like objects ? -
          http://msdn2.microsoft.com/en-us/lib...w(vs.80).aspx)...

          --
          Patrice

          "John" <info@nospam.in fovis.co.uka écrit dans le message de news:
          O$ILVPSiIHA.407 6@TK2MSFTNGP05. phx.gbl...
          Sorry I meant gridvview.
          >
          "Cor Ligthert[MVP]" <notmyfirstname @planet.nlwrote in message
          news:626D5782-279F-4348-99E0-7643314C1CA3@mi crosoft.com...
          >John,
          >>
          >A dataview is not a control, it is a view on the datatable.
          >>
          >Cor
          >>
          >>
          >"John" <info@nospam.in fovis.co.ukschr eef in bericht
          >news:OqCeyuJiI HA.5160@TK2MSFT NGP05.phx.gbl.. .
          >>Hi
          >>>
          >>Is it possible to create a datasource for dataview control for an sql
          >>string?
          >>>
          >>Thanks
          >>>
          >>Regards
          >>>
          >>
          >
          >

          Comment

          Working...