Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
vasu #1
How to display result from two different table
Hi all
Iam in a problem. Anyone plz help me in retreving data into single
datagrid from two different queries.
Thanks in adavance
vasu
vasu Guest
-
Get result from temporary Oracle Table
Hi, Having problem with temporary table from Oracle. Runing my stored procedure (which stores an amount of row in a temporary table) from an Sql... -
order table result without reloading
I've a page wich show the result of a query in a table. I want to provide a way to order the way the result are shown, something like: <table>... -
[PHP] How to store result in array for later display?
In the following code snippet, I populate an array called $emp_final, which works fine, as I can tell if I uncomment the echo immediately after. If... -
Efficient way to display a dropdown description value when only the key is in the result set
Hi all, I have a results set with a column ( project_id ) which is associated with a dropdown in datagrid edit mode. When not in edit mode, I... -
Result of Mysql Query in a PHP table
Hi, I've a problem: I want to have the result of my Mysql Query in a Table in my php file. Now I've this: <? -
Alvin Bruney #2
Re: How to display result from two different table
The problem is that binding can only occur on a single datasource. You will
need to take these two datasets which you get returned from the two
different queries and merge them into one dataset then bind to this
aggregate dataset. You may be able to use the merge function exposed by the
dataset or you may want to create a new dataset, attach a new table to it
and manually add rows from both datasets into this one datatable. once you
are done, you can bind to this new dataset. Either approach should bring you
the required results.
Here is some code to help you with the lata if you choose to go thru it
DataSet dsTemp = new DataSet();
DataTable Tables = new DataTable();
dsTemp.Tables.Add(Tables);
dsTemp.Tables[0].Columns.Add( " ", System.Type.GetType( "System.String" ) );
dsTemp.Tables[0].Columns.Add( "% variance", System.Type.GetType(
"System.String" ) );
for(int col = 0; col < ds.Tables[0].Columns.Count; col++)
{
DataRow myRow = dsTemp.Tables[0].NewRow();
myRow[2]= Double.Parse(ds.Tables[0].Rows[0][col].ToString()) -
Double.Parse(ds2.Tables[0].Rows[0][col].ToString());
myRow[1]= (Double.Parse(myRow[2].ToString()) /
Double.Parse(ds2.Tables[0].Rows[0][col].ToString())) * 100;
myRow[0]= ds.Tables[0].Columns[col].ColumnName;
dsTemp.Tables[0].Rows.Add(myRow);
This will point you down the right direction.
Regards
--
-----------
Got TidBits?
Get it here: [url]www.networkip.net/tidbits[/url]
"vasu" <vasu@stcroixsystems.com> wrote in message
news:uCwtNf0rDHA.2224@TK2MSFTNGP09.phx.gbl...> Hi all
>
> Iam in a problem. Anyone plz help me in retreving data into single
> datagrid from two different queries.
>
>
> Thanks in adavance
>
> vasu
>
>
Alvin Bruney Guest
-
Todd #3
Re: How to display result from two different table
"vasu" <vasu@stcroixsystems.com> wrote in message news:<uCwtNf0rDHA.2224@TK2MSFTNGP09.phx.gbl>...
Is it possible to join the two queries into one? Use an "Inner Join".> Hi all
>
> Iam in a problem. Anyone plz help me in retreving data into single
> datagrid from two different queries.
>
>
> Thanks in adavance
>
> vasu
If two seperate tables have a like column in each that can link to
each other, then you can use that like value to create a join of the
two tables. For example, if you are pulling "names" from one table in
your first query, and then "locations" from another table in your
second query, would you somehow be able to join the two tables on a
like value and run one query to create one dataset? Let's say that
each table has a column named "IDNumber" that represents a unique
number for a certain person on both tables. Example:
SELECT
Names.Firstname,
Names.LastName,
Locations.PrimaryOffice,
Locations.AlternateOffice
FROM
Names INNER JOIN Locations ON Names.IDNumber = Locations.IDNumber
order by Names.LastName
Then all you would need to do is set the source and bind that single
dataset to the control.
Todd Guest



Reply With Quote

