Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How can we binddata?

How can we binddata?

Scheduled Pinned Locked Moved ASP.NET
databasequestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    muthukumaar
    wrote on last edited by
    #1

    is it possible to bind data from two diff.database's tables in a single datagrid?how?

    M R 2 Replies Last reply
    0
    • M muthukumaar

      is it possible to bind data from two diff.database's tables in a single datagrid?how?

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      If the two tables are relatable they can be JOINed in a SQL statement. This would result in a single DataTable with the data from the two database tables, which could then be bound to a datagrid. For example, the following SQL statement selects all the distinct customers who have placed orders (pulling CustomerID from the Orders table, and joining in the associated CustomerName from the Customers table):

      Select Distinct
      o.CustomerID
      , c.CustomerName
      From Orders o INNER JOIN Customers c ON o.CustomerID = c.CustomerID

      Is this what you were talking about?

      1 Reply Last reply
      0
      • M muthukumaar

        is it possible to bind data from two diff.database's tables in a single datagrid?how?

        R Offline
        R Offline
        Rakheesh Chalil
        wrote on last edited by
        #3

        Create one datatable in your code behind file. (The DataTable is an in-memory representation of a block of data).Get the data from the database in two different datasets. Then fill the created data table with data from the different datasets available from different tables. (You have to programatically fill each column in the datatable). After filling the manually created datatable, bind the datagrid with this table. From the above solution, you are binding the data grid to the manually created datatable in your code. The datasource can be anything. But be cautious this can reduce the performance of the application. Hope this will help you Thanks Rakheesh

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups