ASP .Net Datatable Problem
-
Hi, How can I filter two different datatables in a single datatable? like consider I have following two datatables DataTable A DataTable B PID | CID CID | FID 1 | 1 1 | 1 2 | 2 4 | 8 4 | 16 16 | 32 So after filtering I can have a output like DataTable C PID | FID 1 | 1 4 | 32 So in my filtered dattable I can have only matching results of datatable A and Datatable C? How can I do this using .Net datatable?
Rock Star
-
Hi, How can I filter two different datatables in a single datatable? like consider I have following two datatables DataTable A DataTable B PID | CID CID | FID 1 | 1 1 | 1 2 | 2 4 | 8 4 | 16 16 | 32 So after filtering I can have a output like DataTable C PID | FID 1 | 1 4 | 32 So in my filtered dattable I can have only matching results of datatable A and Datatable C? How can I do this using .Net datatable?
Rock Star
This isn't an ASP.NET question, its a database question. You're best bet would be to construct the query to return the results appropriately.
I know the language. I've read a book. - _Madmatt
-
This isn't an ASP.NET question, its a database question. You're best bet would be to construct the query to return the results appropriately.
I know the language. I've read a book. - _Madmatt
I think he is asking to manipulate Application end DataTable, not Database tables. :sigh:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NET -
Hi, How can I filter two different datatables in a single datatable? like consider I have following two datatables DataTable A DataTable B PID | CID CID | FID 1 | 1 1 | 1 2 | 2 4 | 8 4 | 16 16 | 32 So after filtering I can have a output like DataTable C PID | FID 1 | 1 4 | 32 So in my filtered dattable I can have only matching results of datatable A and Datatable C? How can I do this using .Net datatable?
Rock Star
You need to recreate the new DataTable. Create Column using
DataTable.Columns.Add(new DataColumn()
To add a column To add a new Row useDataTable.NewRow()
then add the row asDataTable.Rows.Add
:rose:Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NET -
I think he is asking to manipulate Application end DataTable, not Database tables. :sigh:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NETI realize he is asking for that but it would be more effecient to do it at the database level.
I know the language. I've read a book. - _Madmatt
-
I realize he is asking for that but it would be more effecient to do it at the database level.
I know the language. I've read a book. - _Madmatt
Ok... No big deal buddy.. :thumbsup:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NET -
You need to recreate the new DataTable. Create Column using
DataTable.Columns.Add(new DataColumn()
To add a column To add a new Row useDataTable.NewRow()
then add the row asDataTable.Rows.Add
:rose:Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NET -
Hi, How can I filter two different datatables in a single datatable? like consider I have following two datatables DataTable A DataTable B PID | CID CID | FID 1 | 1 1 | 1 2 | 2 4 | 8 4 | 16 16 | 32 So after filtering I can have a output like DataTable C PID | FID 1 | 1 4 | 32 So in my filtered dattable I can have only matching results of datatable A and Datatable C? How can I do this using .Net datatable?
Rock Star
Copy all DataTable to arrays, manipulate or filtering and create new DataTable
-
Copy all DataTable to arrays, manipulate or filtering and create new DataTable
-
I was thinking of using select method. Is there any example for selecting data from two different datatables?
Rock Star
If you are using dotNetFramework 3.5 using Linq would be the easiest way
-
If you are using dotNetFramework 3.5 using Linq would be the easiest way
Use the SQL sentence: SELECT A.PID,B.FID FROM A,B WHERE A.CID=B.CID, write it in Visual Studio or Procedure
April Comm100 - Leading Live Chat Software Provider
-
Hi, How can I filter two different datatables in a single datatable? like consider I have following two datatables DataTable A DataTable B PID | CID CID | FID 1 | 1 1 | 1 2 | 2 4 | 8 4 | 16 16 | 32 So after filtering I can have a output like DataTable C PID | FID 1 | 1 4 | 32 So in my filtered dattable I can have only matching results of datatable A and Datatable C? How can I do this using .Net datatable?
Rock Star
???Do you want to get a datatable?? StringBuilder strSQL= new StringBuilder("select A.* from A a inner join B on A.CID = B.CID"); SqlCommand cmd = new SqlCommand(strSQL.ToString(), conn, transaction); DataTable C= new DataTable(); C.Load(cmd.ExecuteReader(), LoadOption.Upsert);
April Comm100 - Leading Live Chat Software Provider