datatable

ASP.NET: Shortest way to render DataTable to a string (HTML)?

What is the shortest way to convert a DataTable into a string (formatted in HTML)? Programmatically binding to a UI control and rendering to an ASP.NET page is not acceptable. Can't depend on the ASP.NET page lifecycle. The purpose of this shouldn't matter, but to satisfy curiosity: This is for logging/debugging/dump purposes in algo...

Get Value of Row in Datatable c#

Hi, i have a problem with my code. foreach (DataRow dr in dt_pattern.Rows) { part = dr["patternString"].ToString(); if (part != vpart) { System.Console.WriteLine(part); System.Console.WriteLine("Geben Sie bitte für den Abschnitt die AT ein: "); temp = System.Console.ReadLine(); AT = ...

Is this a bug in DataTable API? Changes are stored/executed in the "wrong sequence"

Edit: any comments whether you think this is a .NET bug or not would be appreciated. I have a bug which I've managed to simplify to the following scenario: I have a DataTable where the primary keys must be kept consecutive, e.g. if you insert a row between other rows, you must first increment the ID of the succeeding rows to make space...

Another DataGrid Binding Question

Hello there! I'm hoping that one of your WPF/DataGrid/Binding gurus can help me out here. I've done a bunch of searching on the subject and while datagrid binding tutorials and tips are plentiful (and I feel like I've read every single one of them), I'm still stumped on this piece. My setup is this: I have an application that has a b...

different by ref question using a simple =

I have a variant on the by ref question. I know all about calling with the ref or our parameters and how it affects variables and their values. I had this issue with a DataTable and I want to know why a datatable is different than a simple integer variable. I have the physical answer on how to fix the problem but I want to know why it...

How to change the datasource on a YUI datagrid after creation

I am using the Yahoo DataTable for which the API is here. I am having difficulty changing the data once I have rendered the grid once. I am using jQuery to get data via AJAX, or from a client side data island and need to put this back into the grid. There is no setDataSource method in the DataTable API, and changing 'dataSource.liveDat...

Adding Datarow between Rows?

Hello, how can i add rows between existing rows in a datatable ? Thanks ...

the point of the Field extension method

What is the point of the Field extension method on DataRow (for untyped DataTables)? Here is a comparison of using Field or not using it. with Field: myRow.Field<Guid>("myColName") without Field: (Guid)myRow["myColName"] I don't see any compelling improvement. ...

How can I make DataTable enumerable ?

I cannot use AsEnumerable() on DataTable, I'm using C# 3 but I'm just targeting 2.0 framework (LINQ capability is courtesy of LINQBridge). Is there any way I can make DataTable enumerable without using Select() ? bool isExisting = (bdsAttachments.DataSource as DataTable).Select().Any(xxx => (string)dr["filename"] == filename); [EDIT]...

ODP.net Oracle Decimal Number precision problem when filling a dataset. Exception: Arithmetic operation resulted in an overflow

I am working in c# .net 2 (Visual Studio 2005 SP1) attempting to fill a dataset with the results from a select * from table from an Oracle10g database. The .net framework, IDE and database cannot be changed at this client site. I'm connecting using the ODP.net provider the dll version is 2.102.2.20 When I run the fill command I get an ...

difference between 2 datatables

I have two datatables. DataTable dtRequired and DataTable dtResult. I want to output a datatable that contains rows that were not present in dtResponse but were found in dtRequired. Approach 1 We have been using the algorithm specified at the following url http://weblogs.sqlteam.com/davidm/archive/2004/01/19/739.aspx. And this algori...

Sort DataTable rows by length in c#.

How to do following scenario: I have some DataTable which contains for example some rows: 1.rowa 2.rowab 3.row 4.rowaba ... n. rowabba How to sort rows by lenght, not by name. I wan to to sort Table by length of fields. ...

How to read a csv file into a .net datatable

How can I load a csv file into a System.Data.DataTable, creating the datatable based on the CSV file? Is there a class library for this or can I use ADO.net to connect to the file? ...

DataTable.Select("ColumnName IN ") Guid error

I'm having problems with a DataTable line, the idea is that I want to pull out of a series of rows any rows where one of the column values is in a set of guids. However, I'm getting a guid / string comparison error from the select() function. The code is as follows: Dim sb As New StringBuilder For Each Row As DataRow In dtData.Rows ...

How to get Max String Length in every Column of a Datatable

I have a DataTable object. Every column is of type string. Using LINQ, how can I get the maximum string length for every column? ...

JSF, datatable in datatable

Hi, Could someone please tell me, how should be the backing bean of a page that shows datatable in datatable. For example: If I want to show the users in the cities, the below code would be the design part of the page, but what about the bean? <h:form><rich:dataList var="city" value="#{myBean.allCity}"> <h:outputText value="#{city.name...

Changing values of a column in a full DataTable?

Hi I Fill my DataTable which has 3 columns(col1 int, col2 int , col3 string). Now, I wanna to change all values of col2 with adding for example 3 number to them.... Any suggestion please. ...

When Binding a GridView to a DataTable, How can we Change the value displayed by a BoundField

Hi.... When Binding a GridView to a DataTable, How can we Change the value displayed by a BoundField ...

Export DataTables into multiple Excel worksheets

I've got a load of DataTables that I want to export into several Excel worksheets (in a new spreadsheet / Excel file). The "solution" that already exists in the code I have is two nested for loops, iterating over all the rows and columns, inserting data cell-by-cell. This isn't ideal as the process takes well over 10 minutes. There's a f...

how to clear off gridview?

I'm creating a dynamic gridview function which will bind different tables from DB into a datatable and then assign the datatable to the gridview! This is how it works, i have a dropdownlist, gridview and a button, the button will fire specific function based on the dropdownlist selection and then gridview will bind the data, my problem i...