datatable

DataTable to List<T> conversion

Is there any better way than the following? Particularly, I want to replace Activator with something else. public static List<T> ToList<T>(DataTable dt) { Type type = typeof(T); List<T> list = new List<T>(); foreach (DataRow dr in dt.Rows) { object[] args = new o...

Load XML file into DataTable (not from a Database)

I'm looking into changing my application to load its xml format data files into DataTables (and a DataSet?) instead of deserializing them into classes. I can generate a dataset using xsd.exe, but I'm not having any luck finding any examples showing how to use it. My Google searches have been hopelessly clogged with examples using xs...

Load a CSV file into a DataGrid

I'm having a go at moving one of our simpler apps to Silverlight (a bit of a learning exercise). I've quickly come unstuck as I can't figure out how to load (or bind maybe?) a csv file to a datagrid (i.e. so you can point the app at a local csv file and display it to the user). I do have boilerplate code to parse a csv file and return a ...

DataTable.Select date format problem

I'm filtering a datatable on a date range using DataTable.Select, my criteria string is: "CreatedOn >='03/11/2009 00:00:00' AND CreatedOn <='03/11/2009 23:59:00'" This filter returns no rows (even though I can see matching rows in the unfiltered datatable). However I notice if I change the criteria to (note the day/month transposition...

Query a DataSet

I'm reading data from xml files into a strong typed DataSet. The data ends up in multiple tables; can I run queries against it to create a denormalized view to display in a DataGrid? Sample input: <PeopleFile> <address> <street>123 some street</street> <town>anytown</town> <resident> <first>Jane</first> <last>Doe</last> ...

Substring test within DataTable.Select()

I have a DataTable with results already pulled down from a back end. I want to do a DataTable.Select(), but the criteria is based on a SUBSTRING of one of the columns. Is there syntax to use in the Select() method that allows for substring of a column test, or do I have to do it the hard way -- scan each row. ...

Transfer Datatable from one aspx page to another C#

I have question which I hope some one can answer, what is the best way of transferring Datatable to another .aspx page so it can gathered and binded to Gridview in C#? Cookies? Sessions? Cache? ...

Linq : select value in a datatable column

Hi, How do you use LINQ (C#) to select the value in a particular column for a particular row in a datatable. The equivalent SQL would be: select NAME from TABLE where ID = 0 Thanks in advance. ...

Hide a row in a datagridview (WinForms/C#)

Say I have a DataGridView Control, this grid is filled through a DataTable. Now, I'd like to add some dynamic filtering, by means of a checkbox. When the _CheckedChanged event is launched and Checked is set to true, I exectue a filter; DataRow[] rows = grid.Select("foo = bar"); No I want to only show these records in the grid. Now, wh...

how to add a pager to dynamic datatable in jsf 1.1

Hi, i've been trying to add a pager to a dynamic datatable. I am using the BalusC code at :http://balusc.blogspot.com/2006/06/using-datatables.html Dynamic columns are working great, but now i need to programatically add a simple pager to allow the user to scroll through the records. I'm using jsf-ibm components, where there exists a...

DataView Filter - Excluding Null when not required.

Language VB.NET (VS 2008) Database: ACCESS The DataView doesn't seem to be filtering correctly. It seems to automatically filter out null values even though it is set to "Serial LIKE '%" & tcSerialTB.Text & "%'" Code: ci = New DataTable("Capital") Dim cid As New DataColumn cid.DataType = System.Type.GetType("System.Int32") cid.ColumnN...

Updating Bean from JSF dataTable

I've got this h:dataTable and form: <h:form> <h:dataTable value='#{bean.allData.dataItems}' var='item'> <h:column> <h:outputText value='#{item.id}' /> </h:column> <h:column> <h:inputText value='#{item.name}' /> </h:column> </h:dataTable> <h:commandButton value="Save" action="#{bean.saveEntries}"/> </h:form> So ...

jquery datatable plugin doesn't seem to sort columns with links properly

i have a column that was pure text and the sorting worked fine but when i cahnge the column data to html regular links, the sorting seems quite random and broken. I couldn't find any other documentation on this issue on the site. http://www.datatables.net/usage/features any suggestions? ...

c# dataGridView random cells location change (Edit: Inter Process Synchronization?)

Hi, I have a dataGridView displaying data from DataView based on DataTable. DataTable is updated with high frequency from a background thread (usually one row a time) but with varying regularity, i.e. sometimes time between updates is 0.5 ms, other few miliseconds. As datagridview is bound to DataView, I do not send requests for refresh ...

How to retrieve a list of tableadapters?

BACKGROUND: Most of my programs use table adapters, and the connection strings are stored in app settings. This works fine, but was a real PITA when switching from development to production environment. I had to change manually the connection strings before and after starting my work on any app. After a bit of research I found how to sw...

Trying to create separate instance of DataSet, but I can't separate them

Hello, I have a DataSet called Apples. I need to massage the data table in there so that I can add blank row and a couple other rows. These rows need to be added because I am binding to a ComboBox. I do not want to add these as rows to my actual DataSet, so I want to create a copy of it and bind my ComboBox to the copy. Problem is, whe...

Add two arraylists in a datatable

I have two arraylists. One contains filenames and the other contains failurecount. These values are from database tables in the code behind. Now I want to add these two arraylists to one datatable. Is there a way to do this? ...

Using BETWEEN in a DataTable.Select

I thought this would be simple but obviously not! Basically, I have a date and want to do a 'between' on two date columns like this: myDataTable.Select(myDate & " between (StartDate and EndDate)") Where StartDate and EndDate are date columns that do exist in the DataTable. Any ideas? ...

Mapping special null constant values into DBNull in a DataTable

I'm working with an existing object framework that uses special values to represent NULL for primitives int, DateTime, long. Data containing these values are added to a DataTable and displayed in third-party controls such as XtraGrid. All is fine, except when aggregates are applied to the data. In this case, obviously the special value...

Working with DataTables

These are two records which exist in a table: ibrahim_balouch ibrahim.tasal I want to send an email to ibrahim.tasal. Here is my code: string user2 = dt1.Rows[1].ItemArray[0].ToString(); mail.Cc = dt1.Rows[1].ItemArray[0].ToString() + "@Roshan.af"; Is this correct? ...