How can we binddata?
-
is it possible to bind data from two diff.database's tables in a single datagrid?how?
-
is it possible to bind data from two diff.database's tables in a single datagrid?how?
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.CustomerIDIs this what you were talking about?
-
is it possible to bind data from two diff.database's tables in a single datagrid?how?
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