tagged [datatable]
Check if value exists in dataTable?
Check if value exists in dataTable? I have DataTable with two columns and . I want to check if the given string value already exists in the DataTable. Is there some built in method to check it, like f...
Remove all columns with no data from DataTable
Remove all columns with no data from DataTable If all the items for a particular column are empty, I want to remove that column from the DataTable. What's the most elegant way to do this operation on ...
How do I get a DataRow from a row in a DataGridView
How do I get a DataRow from a row in a DataGridView I'm using a databound Windows Forms `DataGridView`. how do I go from a user selected row in the `DataGridView` to the `DataRow` of the `DataTable` t...
- Modified
- 25 Mar at 21:21
Find row in datatable with specific id
Find row in datatable with specific id I have two columns in a datatable: How do I find what the value of Calls is `where ID = 5`? 5 could be anynumber, its just for example. Each row has a unique ID.
How can I reset table.DefaultView.RowFilter?
How can I reset table.DefaultView.RowFilter? The code below works fine and filters the rows correctly but how would I restore the table to its original state? Thanks
- Modified
- 2 Jan at 03:2
How to calculate the sum of the datatable column in asp.net?
How to calculate the sum of the datatable column in asp.net? I have a DataTable which has 5 columns: - - - - - The DataTable contains 5 rows. How can I show the sum of the Amount Column in a Label Con...
- Modified
- 29 Feb at 08:32
difference between getting value from DataRow
difference between getting value from DataRow Sample code: My question is: - `row["name"]``row.Field("name")`-
Insert the whole value of DataTable bulk into postgreSQL table
Insert the whole value of DataTable bulk into postgreSQL table In SQL we do something like this for bulk insert to datatable but in PostgreSQL how to do this operation
- Modified
- 9 Jun at 18:39
Compare two DataTables and select the rows that are not present in second table
Compare two DataTables and select the rows that are not present in second table I have two DataTables and I want to select the rows from the first one which are not present in second one For example: ...
- Modified
- 18 Feb at 16:56
Querying Datatable with where condition
Querying Datatable with where condition I have a datatable with two columns, I want to query the datatable, against the column `EmpID` and `Empname`. For example, I want to get the values where
Inner join of DataTables in C#
Inner join of DataTables in C# Let T1 and T2 are `DataTable`s with following fields I need the joint table How this can be done in C# code in a simple way? Thanks.
- Modified
- 10 Feb at 16:22
The source contains no DataRows
The source contains no DataRows `ds.Tables[4]` has rows but it throws the exception > "The source contains no DataRows." Any idea how to handle or get rid of this exception?
Get all column names of a DataTable into string array using (LINQ/Predicate)
Get all column names of a DataTable into string array using (LINQ/Predicate) I know we can easily do this by a simple loop, but I want to persue this LINQ/Predicate?
Creating a SQL Server table from a C# datatable
Creating a SQL Server table from a C# datatable I have a DataTable that I manually created and loaded with data using C#. What would be the most efficient way to create a table in SQL Server 2005 that...
- Modified
- 28 Aug at 18:46
Easiest way to copy a dataview to a datatable in C#?
Easiest way to copy a dataview to a datatable in C#? I need to copy a dataview into a datatable. It seems like the only way to do so is to iterate through the dataview item by item and copy over to a ...
Access cell value of datatable
Access cell value of datatable Can anyone help me how to access for example value of first cell in 4th column? for example, how to access to value d, if that would be datatable? Thanks.
- Modified
- 26 Jan at 17:5
How to get the row number from a datatable?
How to get the row number from a datatable? I am looping through every row in a datatable: I would like to get the index of the current row within the dt datatable. for example: How do i do this?
Mapping columns in a DataTable to a SQL table with SqlBulkCopy
Mapping columns in a DataTable to a SQL table with SqlBulkCopy I would like to know how I can map columns in a database table to the datatable in c# before adding the data to the database.
- Modified
- 11 Jul at 23:15
How to pass DataTable.Select() result to a new DataTable?
How to pass DataTable.Select() result to a new DataTable? I have a `DataTable` named `dt2` with data. I am calling its `Select` method to get some specific rows. How can I pass the `Select`-method res...
How to select distinct rows in a datatable and store into an array
How to select distinct rows in a datatable and store into an array I have a dataset objds. objds contains a table named Table1. Table1 contains column named ProcessName. This ProcessName contains repe...
How to know the row index from DataTable object
How to know the row index from DataTable object I'm getting a value from DataGridView, and based on particular I want to know its row index using DataTable object. For instance, if I get the value "th...
Add data row to datatable at predefined index
Add data row to datatable at predefined index I have a datatable with one column: I then want to add a row to that datatable, but want to give a specific index, the commented number is the desired ind...
- Modified
- 17 Dec at 14:46