datatable

JSF dataTable question

HI All, I want to display data using the h:dataTable tags in JSF The data I am displaying has to be in a format like this: Name: XXXX ID: 8989 Age: 32 I have seen several examples on the web that tell you how to display the data like this: Name ID Age XXX 8989 32 Since the dataTable tag only has a sub tag h:column and...

Populate DataTable with LINQ in C#

I have a method in my app that populates DataTable with the data using the following code: DataTable dt = this.attachmentsDataSet.Tables["Attachments"]; foreach (Outlook.Attachment attachment in this.mailItem.Attachments) { DataRow dr = dt.NewRow(); dr["Index"] = attachment.Index; dr["DisplayName"] = String.Format( ...

WPF LsitView grows bigger than it's containing Canvas

I have a ListView which is using a gridView to display a DataTable and when new rows are added to the DataTable the LsitView grows as expected but when it reaches the bottom of the Canvas it carries on growing. I want it to stop when it reaches the height of the Canvas, how can Iconfigure this? The Canvas has a dynamic height which is ...

Join DataTable with List<SomeObject>

I have a DataTable and a List of objects. I need to return all rows in the DataTable where a property in the List is a certain value. The List is only used for filtering the datatable (but the filter column isn't containined in the datatable. I'm sure this must be possible with link The DataTable contains: MembershipID Username Pas...

How to load data from xml with condition?

How can I load data from an xml file into a DataTable with a condition? ...

How to sort dataset.table[0] then get the top 10 ?

I'm adding an auto increment column (called "rowNum") to my table and it's working good, after that I use this code to sort datatable rows : DataView dv = MyDataSet.Tables[0].DefaultView; dv.Sort = "columnName DESC"; where columnName is one of my columns (not the auto increment one). Now,The problem is: when I want to get the top 10 ...

DataTable Select vs LINQ Select

Any advice on when DataTable.Select should be used versus LINQ Select when dealing with an in-memory DataTable? I find LINQ syntax easier and more powerful, but I'm not sure if there are performance or other issues which make a DataTable select preferable. (I'm using a third party API that provides a DataTable that has been pre-populat...

Convert DataTable to List<>

Hello, I have an strongly typed DataTable 'MyType', I'd like convert it in an List. How can I do this ? Thanks, ...

C# Custom DataView

Hi, I have some requirement to implement a very non-standard sort in my data grid, the grid is currently bound to a DataView with the Original rows data row filter set, the data comes in realtime so i do an accept changes on a timer every second to show any changes made on the underlying data table. The grid is read-only, it's purely d...

C# Reordering the Tables in a Dataset

I create a custom dataset that I pass off to a black boxed component. The dataset consists of usually 5-6 tables (with unique names assigned by me). The component takes the dataset and builds a drop down combo box based off the table names. What I am needing to do though is to change the ordering of the tables within the dataset. I n...

Odd paging problem with DataGrid and sorting

I have a data table that is being filled by a stored procedure. I need to filter down the results some, so I get a data view from the default view and apply a row filter to it. I then bind this to my DataGrid. All is fine at this point. I see two pages (17 records with 10 per page). If i apply a sort to the grid though, it now shows...

initalizing an object through a data table

Hi, Is there a way to initialize an object from a database query that returns a datatable? What I mean is, I have an oracle stored procedure that returns a refcursor for data from a table. In my code, I have an object for that table (not using an ORM). Is there an easy way to initialize the object from the data in the datatable, or d...

Why does converting a datasource to a datatable prevent formating

I have come accross a strange problem that can be illustrated using the 2 seperate code blocks below. If i use the first block, you can clearly see that column 5 has a currency format applied to it. Using the second block where the only difference is that the string array is added to a datatable and then used as the datasource -> no ...

putting contents of one datatables into another datatable with particular field value changed

gud morn Hi all, There are 3 datatables. I am comparing two datatables and putting the values in the third datatable. Now I want to add the third table to the first one with status field changed.(in status field of first datatable I want to add a column showing the status field value of third datatable) How can i do this. ...

how best managing paging with subsonic 3.003

hi everyone i'm really engaged with subsonic but I'm not sure how make it work with paging i mean how can i get "the page" in a list or how is the best way to managing the total table in my base, page by page youll see i tried three things: m02colegio is an class generated from activerecord IList<m02colegio> loscolegios; loscoleg...

Do I need all database columns in my DataTable for SqlBulkCopy WriteToServer?

I'm importing some data from a CSV, and it doesn't have all the fields my table does. I was making a DataTable with only the columns of my CSV, but I'm getting errors about converting from String to Boolean. None of the fields I'm adding are Boolean, so I'm assuming its a problem with the fields I left alone. Do I need to have a 1-1 m...

SqlDataAdapter Insert with Multiple Tables

I have a static class which loads the initial data for my c# windows forms application. The data is retrieved via 1 sqldataadapter with one query selecting from multiple sql server tables. These are then used to populate multiple datatables like so and filled into my dataset da.TableMappings.Add("Table", "ChannelTypes"); da.TableMapping...

automatically set the value of one variable depending on another variable's value in sql table

I am new to sql and How can I automatically set the value of one variable depending other variable's value. I have price in foods table, and in orders table I want to change the total value of the price according to the # of orders for a specific food. ...

Select DataTable row, filtered by GUID

I have a non-primary-key column with GUID's (with DataType System.Guid) and it appears you cant use DataTable.Select on that column. (Only DataRowCollection.Find but it requires GUID to be Primary Key column, which is not my case) Anyway, I need to get that row WHERE UniqueId = *GUID* Maybe there are some LINQ tricks that can do the jo...

LINQ to DataSet case insensitive group by

I have a data table and I want to perform a case insensitive group by over a column of data table (say Column1 of type string). I observed that normally LINQ to DataSet perform case sensitive comparison. For example if Column1 is having two values say Test and test, after applying group by it returns two seperate rows with values Test an...