datatable

Is datareader quicker than dataset when populating a datatable?

Which would be quicker. 1) Looping a datareader and creating a custom rows and columns based populated datatable 2) Or creating a dataAdapter object and just (.Fill)ing a datatable. Does the performance of a datareader still hold true upon dynamic creation of a datatable? ...

Adding new row to datatable's top

When we use datatable.newrow command, a new empty row added to bottom of rows. However I want newrow to added to top of datatable. How can I make it? ...

Which direction should the arrows point in a sorted table?

In a sorted table, it's common to have an up or a down arrow indicating the sort style. However, I'm having some trouble determining which direction the arrow should point. In an ASC sort, characters are sorted 1-9A-Za-z. Should the arrow point up or down? I've found implementations of both on the web, so that didn't help me much: Up an...

What is the best way to remove duplicates from a datatable?

I have checked the whole site and googled on the net but was unable to find a simple solution to this problem. I have a datatable which has about 20 columns and 10K rows. I need to remove the duplicate rows in this datatable based on 4 key columns. Doesn't .Net have a function which does this? The function closest to what I am looking f...

Datatable's Compute Function For Rows

As we know that, with compute function of datatable we can get sum of columns. But I want to get sum of a row of datatable. How can I do it with asp.net 1.1? Edit: I will explain with a example: I have a datatable like image below: With compute function we can get the sum of each column (product). Such as for product1, 2 + 12 + 50 + ...

Migration From Datatable to Linq to Sql

In past I use dynamic sql and datatable to get data from database. Such as : Public shared function GetUsersByUsername(byval username as string) as datatable dim strSQL as string="select * from Users where Username= " & username return dbClass.datatable(strSQL) end function And I could use this data such this: Dim Email as str...

What's quicker at resolving, DataSet.Tables or Dictionary<string, Tables>

I am creating a mock database for import export tests (of the algorithm reading and writing complex data structures to our database, not just to test IO operations), and am trying to decide whether to use a DataSet to store the mock tables (by table name) in the faux-database, or Dictionary() In terms of retrieving a datatable by name, ...

Multiple rows per record in JSF?

having a myfaces datatable, is is possible to have 2 rows for each record? my simple one-row table looks like the following: <h:dataTable id="somelist" value="#{MyBean.somelist}" var="item"> <h:column> <f:facet name="header"> <h:outputText value="ID"/> </f:facet> <h:outputText value="#{item.id}"/>...

.net Dataset Primary-Keys - enforcing uniqueness?

I have a small dataset with a few datatables. I load the datatables from various DBs and have a config file that I read to determine the primary keys I want to enforce on the given datatables. If the config doesn't contain a proper (non unique) primary key, how can I catch this event when applying the primary key to the datatable? Cur...

Grouping rows of a datatable in VB asp.net 2.0

Hello, As the name suggests I am trying to group rows in a datatable. To go into further detail this table has identical rows except for one field(column). Basically what I am trying to do is put all the different fields of the identical rows and put them in single field whilst deleting the other rows. Here is the syntax that I am curr...

Why doesn't globally declared DataTable retains its value?

I have an aspx page with a gridview. In my page load event, I load a datatable with all the data like so: HistoricalPricing historicalPricing = new HistoricalPricing(); DataTable dtHistoricalPricing = new DataTable(); protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { dtHisto...

Best c# generics class for replacing DataTable as collection?

I'm trying to bring a legacy C# .NET 1.1 application into the modern era. We use DataTables for our collections of what could have been business objects. Given that most of the code thinks it is talking to the interface of a DataRow, what generic collection would make for the least painful transition? ...

Can you get a DataTable from an ObjectDataSource?

Hello, If I have an ObjectDataSource defined at design time, can I get a DataTable from that ObjectDataSource at runtime? I have a method that returns a DataTable that I am using for the Select method property of the ObjectDataSource. ...

Which one do you prefer for Searching/Reporting DataTable or DTO or Domain Class?

The project currently I am working of requires a lot of searhing/filtering pages. For example I have a comlex search page to get Issues by data,category,unit,... Issue Domain Class is complex and contains lots of value object and child object. .I am wondering how people dealing with Searching/Filtering/Reporting for UI. As I know I hav...

Why is my ApplicationCache passing back a reference instead of a value?

This is an odd thing I've just run into. I have a web application with a small DataTable stored in the ApplicationCache to reduce the amount of queries to a separate since the data is a lookup table that doesn't change often. I access this DataTable twice within a given page. Once to bind the data to a drop down list in my Page_Load me...

Show number of results in gridview based on dropdown?

I have a datatable which returns around 30,000 records. I am displaying these records in an ASP:GridView control. I have a dropdown control in which I want the user to be able to select the number of records to display in the GridView. The default should be All, but it could also have values such as 20, 50, 100 for example. I am not q...

What is the memory overhead of storing data in a .NET DataTable?

I'm trying to get a handle on the amount of memory overhead associated with a .NET DataTable, and with individual DataRows within a table. In other words, how much more memory does a data table occupy than what would be needed simply to store a properly typed array of each column of data? I guess there will be some basic table overhead, ...

.NET datatable to SQL Server stored procedure as XML

Ok. So I am pretty new a this. I have a datatable that I want to pass to a stored procedure for further manipulation. I have read some stuff on the web and it looks like I should be able to convert the datatable to XML and then pass that to the stored procedure. What am I doning wrong? I have SQL server 2005. The data never gets passe...

C# - Modifying a Data Table

I have a Data Table that is filled from a database connection. I would like to run checks on the Data Table like replacing the numbers with text and add my own data before binding it to the Data Grid for viewing. How do I access one piece of data in the Data Table? Thanks. ...

Fastest way to convert datatable to generic list

I have a data tier select method that returns a datatable. It's called from a business tier method that should then return a strongly typed generic List. What I want to do is very similar (but not the same as) this question: http://stackoverflow.com/questions/208532/how-do-you-convert-a-datatable-into-a-generic-list What's different i...