datatable

please help me in creating a sort expressions for datatable in vb.net

I have got a datatable which contains many columns in which three are main: hotelid dshotelid hotelname Some hotels contain only dshotelid, some contains only hotelid and some contain both dshotelid and hotelid. I need sort in such way so that those hotels who got both dshotelid and hotelid should be on top and then those hotels who...

validate input field in jsf datatable

I have input field in jsf datatable which i am validating and adding error message but error message doesn't get displayed. What is the best approach in validating input field in jsf datatable and adding message. <h:inputTextarea id="textarea1" styleClass="inputTextarea" value="#{varreviewList.comment}"> <f:attribute name="msgRef" valu...

Dataset manually put into the viewstate of a Web UserControl not kept after postback

I've created a Web User Control that is placed on the page at design time. It's purpose is to pop up with a grid of items the user is to choose from. So I've got a gridview on it. And this code in the usercontrol: Public Property DataTable() As Data.DataTable Get If Not IsNothing(ViewState("_SelectGridDataTable")) The...

Adding a datatable and a session containing datatable

I have a session which contains a datatable and also have a function which returns a datatable. I need to add these two. How can I do this? The below code is to be replaced with correct code. Session("Table")=Session("Table")+obj.GetCustomer() ...where obj is an object of the business layer. The '+' sign cannot be used to add these ...

How can we filter datatable in c#?

Hi All, I have specific requirement with datatable which i am not able to get. Please help me to solve my problem. My query is as below The datatable i have with data is C1 C2 C3 C4 C5 R1 1 2 3 4 25 R2 6 7 8 24 10 R3 11 22 13 14 15 R4 16 17 23 19 20 R5 21 7 18 9 5 In output...

Problem with DataTable.acceptChange and WPF

Hi I'm using a method to have my dataTable public static DataTable excutequery(string query) { try { SqlDataAdapter sqladapter = new SqlDataAdapter(query ,cnx ); SqlCommandBuilder commandBuilder = new SqlCommandBuilder(sqladapter); DataTable table = new DataTable(); ...

Option Strict On disallows implicit conversions from 'String' to 'Integer'

txtAddress.Text = DB.ProfileDataset.Tables("tblCustomers").Rows.Item("Address").toString The above code generated Option Strict On disallows implicit conversions from 'String' to 'Integer' error under the Item("Address") I don't know what i did wrong... ...

How to Implement YUI Data table header checkbox Control ?

I have an implementation for local datasource at http://javascript.kunalcholera.com/ I was wondering how we could extend this to datasources which are XHR and not local datasources. ...

.net 2.0: What's the best way to deal with in-memory DataTables?

Hi, I have a csv file that I import into a DataTable. Furthermore I've created a TableAdapter with several queries. Is it somehow possible to execute the queries associated with the TableAdapter directly on the "in-memory" DataTable (doesn't seem so) or do I always have to write the imported DataTable to the database first and then exec...

Selecting distinct months and years and then breakdown of values for

I'm using Open Flash Chart to create statistics and one of the things i need to be able to do is generate a Stacked Bar Chart. Logically i need to be able to Group all the distinct Month/Year combinations, Dec 2009, Jan 2010, Feb 2010 etc. and then from that group all the various rows, i.e. the different types of enquiry a visitor made ...

SQL query to return columns and values which match part of a where condition

Hi all, I am trying to find out if there's a good way to get all the column names, and values for a particular row, where a part of a condition is met. That is, I want to know which fields within my huge nested AND and OR where condition, met which conditions, and their values. The catch is I am actually using the Dynamic LINQ API over...

crosstab in datatable

Is there a way to do cross tab in the datatable ? eg : a function as following taking a datable and returning a crosstab datatable Public Function CrossTab(ByVal dtS As DataTable) As DataTable ' Change rows to columns and columns to rows ' The First Column Changes into Row Titles ' The Row Titles changes into the first column End Func...

How to serialize a DataTable to a string?

Recently I was in the need to serialize a DataTable as a string for further processing (storing in a file). So I asked myself: How to serialize a DataTable into a string? ...

.Net DataTable column export

Im looking to get a column and all its row data from a DataTable object then create a new column in another data table and append it with the new column and its rows. The issue I keep encountering is the row data will come out, as will the column names, but all of the rows are appended to the same column, I'm sure im missing something ob...

Remove duplicates by field from one table using another using LINQ

I have to leave in a DataTable only records with dates currently not present in the database. So I read all existing dates using the stored procedure (is it correct?): SELECT DISTINCT CAST(S.[date] AS DATE) -- original date is DATETIME2(0) FROM ... WHERE ... and load it to a DataTable: var tableDate = new DataTable(); new SqlDataAda...

Adding a Combobox in DataGridView through Datatable

I have a DataGridView and I am populating it through a DataTable. On initializing, I add DataColumns to the DataTable and then set the DataSource of the DataGridView to the DataTable. Here is the code: DataTable mTable = new DataTable("Test"); DataColumn col = new DataColumn; col.DataType = System.Type.GetType("System.Boolean"...

How do I add data from cache to a DataTable?

Hi everyone: I am embarrassed to ask, but what is the best way to add key/value pair data in cache (HttpRuntime.Cache) to a DataTable? I'm currently dumping the key/value pair data from cache into a HashTable, which becomes the DataSource for a Repeater object. Unfortunately, I cannot sort the data in the Hashtable and therefore though...

Suppress Crystal Reports section if there are no rows in a datatable

I have a section in a Crystal Report that I want to suppress. I need to suppress it if there are 0 rows in a particular table in the dataset I am using. How would I do this? The Record Number special field provided appears to be an internal count of records in the report, and does not relate to the rows in the underlying data table. I ...

Copying a DataTable without using the .Copy method

I have a DataTable that's had people wire into it's different column changed events, ect... I need to clear the table out occasionally and fill it with new data, from a different datatable. I was just using targetTable = sourceTable.Copy(), but then the people above me loose the events they've wired into. I was thinking that I could w...

How do I use Linq to group a DataTable by multiple rows/columns into a new datatable with duplicate rows concatenated?

God, Linq confuses me... I've found quite a few examples that do similar things to what I need, but I'm still getting all turned around. I have a table (we'll call it UngroupedTable) that looks like this... ID, Val1, Val2 0001, A, 1 0001, B, 2 0002, C, 3 0003, D, 4 0003, D, 5 I want to use Linq to build a table where essentially in Gr...