Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [.net-datatable]

In .NET, DataTable is a class that represents a table of in-memory data. For the jQuery DataTables plugin, please use [jquery-datatables] tag.

4
votes
2answers
116 views

Making a list of customers who buy the top N items from a supplier

I have a method that works perfectly well and does what it's supposed to, albeit a little slow (30 - 40 seconds). I would like to be able to speed it up or at least make it more efficient, any ideas ...
4
votes
1answer
194 views

Mapping DataTable to a concrete type

I have an extension that adds values to a class and I was wondering if there was a faster way to do this. Does a for loop execute faster or would a LINQ query do better? ...
0
votes
1answer
448 views

Search DataTable by column for a specific row

I would like to know if there are ways to make this run faster. Not a big concern right now, but I would like to think long term, it might be important. This is C#, and I can not change the input ...
4
votes
1answer
136 views

List of classes to datatable

I'm looking for a function to take a list of generic classes, and map it to different layout of datatable. That means, I can't just directly map my class property names and values to grid, I need to ...
0
votes
2answers
288 views

Pull From Oracle into CSV File

I have written this code in C# to connect to an Oracle Database, omitting the tnsnames.ora file, then place results from a query into a CSV File. Is there more efficient way to do this? (Such as ...
4
votes
0answers
743 views

CSV Data Table Extension

This is my library I wrote from scratch for the .net core that imports and exports CSVs from DataTable objects. I've seen a lot of huge complicated libraries that handle this and a million other ...
1
vote
1answer
246 views

Vertical & Horizontal Direction of a DataTable

I wanted to have a DataTable with cells in direction that is top to bottom or bottom to top and left to right or right to left. LR - LEFT to RIGHT RL - RIGHT to LEFT BT - BOTTOM to TOP TB - TOP to ...
2
votes
4answers
1k views

C# SQL query builder to fill DataTable

I'm trying to optimize my code and in the process of doing that I made a class Query_builder that handles SQL queries. That class has couple of methods: ...
2
votes
2answers
2k views

Merge two DataTables by adding corresponding entries

I've been looking over internet for a method of combining 2 datatables with exactly the same cells with numbers to add them together, Merge method never help because it just appended the second table. ...
3
votes
3answers
393 views

Querying employee schedules in a month [closed]

I have this code, this code querying employee schedules in a month, in a work unit. If the List<Employee> count are few, the code works great, but if the <...
3
votes
0answers
164 views

Cleaning up memory after loading Access DB into a datagrid

I wrote an app that pulls a MS Access DB into a DataTable and then displays it into a WPF datagrid. The dialog window has a search button which calls on a class ...
1
vote
2answers
7k views

Calculating the total of each column and display in footer of gridview in DataTable

I've used this code to get the sum of the values of each column and display in footer. Here, the advantage is that I don't have to look for the column name, just get the count of total number of rows ...
4
votes
2answers
3k views

DataTable runtime grouping on user defined criteria

I one of my tools I use the user can define grouping for a DataTable. The criteria are known only at run-time. To achieve this I use a ...
0
votes
1answer
291 views

Populate DataTable with API results

I am querying an API and populating a C# Datatable with the results, then using a Table Value Parameter to populate a SQL Server table with the results. This is my solution, but it is slow and takes ...
2
votes
1answer
155 views

Add data to DataTable

I created a class to operate with concrete table and I want to generalize this code to develop more universal class. Here is one method of this class: ...
5
votes
2answers
238 views

Constructing file paths for each row of a datatable in C#

I need to iterate through a DataTable and columns in each rows and do some data manipulation. Below given is an extract from my code, I use c#.net. I expect maximum rows in datatable will be less ...
2
votes
1answer
838 views

List<List<string>> vs DataTable

I have an application which uses SQLite. In that database I have several tables that I need to be able to read and update in my application. Often I need to 'cross-reference' these tables to get the ...
3
votes
1answer
262 views

Repository/persistence-service implementation

I have the following situation: I have... Models like ServerRoom and ServerCabinet ...
0
votes
0answers
178 views

DataTable extension methods and proper disposing of unneeded resources

I've build two extension methods, that allows me to show DataTable inside window. Below is my code: ...
4
votes
1answer
150 views

Return a paged DataTable

Is there a better way to do it and have it be .Net 2.0 compatible? ...
0
votes
1answer
872 views

How to generate Datarows based on a delimiter in a Datacolumn from a DataTable in C#

In my office, we use a software called Blue Prism, a Robotic Process Automation System. The idea is to allocate tasks for the robots to perform thereby simulating users. The system enables you to use ...
3
votes
1answer
147 views

Rolling up Invoice Items Matching Certain Criteria

I have a listing of invoice line items that I need to apply some convoluted business logic to. We have another listing of items that I compare the invoice items to and if I find matches, I then need ...
6
votes
1answer
2k views

Joining datatables to create a new datatable

I am joining datatables to create a new datatable: ...
4
votes
1answer
16k views
4
votes
1answer
11k views

Using LINQ to perform a LEFT OUTER JOIN in 2 DataTables (Multiples criteria)

I know that exists a lot of solutions about how to create an OUTER JOIN between two DataTables. I created the following code in ...
6
votes
2answers
94 views

Calling functions with different variable types

I need to call the function that will get the value of a datatable cell with the ColIndex, either a text (column name) or an integer (...
9
votes
2answers
2k views

Optimize a generic foreach method that converts Datatable to my object using Reflection

I need to optimize this code block below, this method converts a Datatable object to the Object that I am passing by parameter, in another words, this serializes the object, however I have to run this ...
8
votes
2answers
3k views

WinForm Calculator

I'm looking to get this cleaned up. ...
2
votes
0answers
344 views

Grouping and summing values for food takeout

I have 4 properties which values I generate using LINQ: ...
1
vote
2answers
8k views

Convert datagridview data to DataTable

I made an algorithm to calculate when the user has to purchase material adjusting the date in which the order has to be made, I'm using datagridviews to make it work, but I was wondering if there is a ...
3
votes
2answers
42k views

Getting column values from a datatable

Is there a way I can make the code compact and with fewer ifs? ...
2
votes
2answers
3k views

Divide certain distinct row values into separate columns

This might be difficult for me to describe clearly but I will try anyway. Also note that this is entirely speculative; it might not even be able to run any faster (that is why I am asking). This is ...
6
votes
4answers
69k views

Return a list of values from a single column in a DataTable

I have this code that I was asked to maintain, it is a notification system for a third party application event system (a lot more involved than that but for the sake of this question...) The Code ...
4
votes
3answers
206 views

Classifying rows of data by the number of days to close

DataTable looks like below I would like to simplify this code in a better manner. ...
2
votes
2answers
10k views

Method for getting the DataTable when having connection ID and the SQL command

I am quite new to C# and to the ASP.NET programming. When maintaining the legacy code, I have found rather terrible implementation of the method that is used on many places to get the ...
5
votes
1answer
416 views

Optimize code block for LINQ and non LINQ

I have 2 code block to do same a work and have same target create some thing, but I don't know which block is the best (I mean LINQ or non-LINQ)? First of all, can anyone tell me how to optimize on ...
2
votes
1answer
11k views

Removing columns based on some conditions

This is a follow up to this question. I'm just removing some columns based on some condition as well using the same condition and adding the column values which I am going to remove to another column....
5
votes
2answers
15k views

Set default value for NULL in datatable

I have the following codes, which I created as extension for datatable in my project. It actually worked. Just wonder if there is any optimization can be made through. Thanks. =) ...
3
votes
1answer
120 views

Loose coupling, accessing class properties

I'm trying to get a better understanding of decoupling methods. Right now, I have this method: ...
3
votes
1answer
825 views

Populating DataGrids

I'm building an in house query tool. The main form has a drop down which allows the user to select how they want to find scripts, and a drop down for what server they want to run the query on. There ...
7
votes
3answers
1k views

Dataset with optional addition to where statement

I am trying to generate a dataset from a query that has a where statement. If the user passes a value additional things need to be added to the ...
5
votes
2answers
44k views

Better method for updating data table

I have completed an application which gathers specific records and marks them as Collected. As of now, the application runs perfectly and does exactly what I need ...
1
vote
1answer
692 views

Find abstraction for classes which represent tables with differnt amount of colums (based on DataTables)

I have a lot of classes which are principal equal, but they consist small differences so that I can´t abstract then very well. The classes represent different kinds of DataTables. Every Class has two ...
39
votes
2answers
219k views

Converting DataTable to List of class

I am using ExcelDataReader to import an Excel file to a dataset. Example Excel table: ...
1
vote
1answer
2k views

Adding blank rows for every skipped value in a DataTable

So I have a DataTable that returns results within a month to month range when available. However, when I format the return, I need to still show skipped months as ...
1
vote
2answers
22k views

Remove matched Rows from two Datatable

Here I have two DataTables: dtTotalDateRangeExcludeSundays dtAbsentsLeavesHolidaysWorks Each has 10k+ values, and I need to delete matched rows. ...
2
votes
1answer
10k views

Performance of WPF datagrid when using DataGridTemplateColumn

I am using DataGrid to show storagehouse occupancy (Occupied-Show Image With a box, Not Occupied-Show Empty Image). In DataGrid I am using ...
2
votes
1answer
2k views

A faster implementation of AcceptChanges?

So I started wondering why it takes 3.5 seconds to AcceptChanges for one changed record in a large DataTable. I wrote another ...
4
votes
3answers
15k views

Search datatable faster

I would like to make the search faster as it takes a long time to retrieve the data that I require. Is there a faster method to do this? I have written the code below to allow me to search through a ...
3
votes
1answer
368 views

Is my base class constructed correctly?

I have tables that use BulkManager to save data to database. I moved common functionality to BulkTableBase. Because creation of ...