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...

30 Aug at 23:25

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 ...

19 Nov at 22:43

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...

25 Mar at 21:21

How to delete multiple rows in a DataTable?

How to delete multiple rows in a DataTable? How can I delete specific DataRows within a loop of a DataTable rows which meet a custom condition -lets say the rows having an index of even number-? (With...

26 May at 13:8

How to union two data tables and order the result

How to union two data tables and order the result Q: If I have two DataTables like this : `(emp_num,emp_name,type)` `(emp_num,emp_name,type)` I wanna to Union them and order the result by `emp_name`.

17 Jun at 10:11

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.

17 Dec at 15:38

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

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...

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")`-

11 Jan at 10:10

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

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: ...

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

10 Dec at 07:53

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.

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?

4 Feb at 15:39

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?

17 Feb at 14:48

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...

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 ...

27 Apr at 07:25

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.

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?

17 Jul at 14:5

Export DataTable to Excel with EPPlus

Export DataTable to Excel with EPPlus I want to export a data table to an Excel file with EPPlus. That data table has a property with int type, so I want the same format in the Excel file. Does anyone...

28 Jun at 12:48

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.

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...

5 May at 20:15

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...

3 Jan at 13:21

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...

24 Dec at 09:56

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...

17 Dec at 14:46