datatable

Can we ignore source schema when querying using IDbCommand

Hi, I am using System.Data.IDbCommand to query a table that has a primary key. My query joins it with other tables and fetches me multiple records with the same value in the primary key column but different values in other joined columns and this is the intended behaviour. However, IDbCommand.ExecuteReader().GetSchemaTable() shows that...

Output a single column from a datatable

So this doesn't seem like it should be that difficult, but apparently I'm overlooking something..? I have a datatable that has 4 columns. I want to output only the second column from the datatable. Here's what I've got so far: Dim dt As New DataTable ** Datatable is set here ** Dim row As DataRow Dim col As DataColumn For Each row In d...

Add a new row to an existing dynamic datatable

I have a dynamic datatable, created from a database. I want to add a new row (blank), so there is an option to choose nothing in a combobx. Everything works ok, without adding the new row. But when I add a new row, the combobox displays nothing. What am I missing? Here is the code Dim DT As New DataTable DT = DS.Tables("CallStatus...

c# DataTable select not working with special characters #

I have a datatable select like: productData.Select("Name = 'AAA BBB # CCC'"); I know the entry is there, it just doesn't work because of the # character. I have tried escaping with [] like: productData.Select("Name = 'AAA BBB [#] CCC'"); but it still doesn't work. I know for single quotes I double them so ' becomes ''. But what oth...

jQuery DataTables Show and hide details feature using MVC

Hello. Is there a simple and clear example that shows how to use show/hide details about particular record feature of dataTables jQuery plug-in with MVC? If you have implemented this stuff and may share it with me, I would greatly appreciate it. Thank you for your help! ...

Compare two datatables...

Hello.. i have two datatables with only one column each. i wanted to compare those two columns in two datatables. here is the example.. i am using C#.Net and WPF for achieving this. dt1 apple orange peach banana dt2 apple peach mango apricot now i want to compare dt2 with dt1. dt2 is bound to a list box. so once i match with dt1, th...

How to select number from Excel file?

I use this code to load an Excel file into a datatable: public static DataTable ImportExcelFile(string connectionString) { DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OleDb"); var listCustomers = new DataTable(); using (DbConnection connection = fa...

How to insert 'sub-rows' into a Wicket DataTable

I have an AjaxFallbackDefaultDataTable which contains one row per test result. A test result may have a note attached to it, which needs to be displayed prominently below the test result, hopefully giving a table similar to the following: | Test | Result | Appraisal | |------|--------|-----------| | 1 | 20.0 | PASS | | 2 | ...

Use LINQ to group data from DataTable

Hi everyone, I want to use LINQ to group data from a DataTable (columns: userid, chargetag, charge). The content could look like this: userid chargetag charge ----------------------------- user1 tag3 100 user2 tag3 100 user3 tag5 250 I need something like this as a result: chargetag coun...

reading Excel Open XML is ignoring blank cells

i am using the accepted solution here to convert an excel sheet into a datatable. This works fine if i have "perfect" data but if i have a blank cell in the middle of my data it seems to put the wrong data in each column. i think this is because in the below code: row.Descendants<Cell>().Count() is number of populated cells (not all...

Writing a generic method for .Field<T>() in Linq to DataSet

I have been attempting to write a reusable generic method for lookups on a DataTable. What I have so far: private static IEnumerable<DataRow> GetRow<FType>(string Tablename, string Fieldname, FType Match) { var result = from row in dataSet.Tables[Tablename].AsEnumerable() where row.Field<FType>(Fieldname) == Ma...

Identifying rows in a rich:dataTable using ID instead of index

I'm using a to display an array of my domain objects (POJO) in my web page, like this: <rich:dataTable id="instanceListTable" value="#{instanceListBean.runningProcesses}" var="instance"> The dataTable generates client IDs based on the index in the array, which is later used to identified the row that user selected. The problem is, th...

h:selectOneMenu default value issue when put it in h:dataTable

Hi guys, i have a problem with h:selectOneMenu. If i put it in h:dataTable i'm unable to set the default value. This is the code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt; <ui:component xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelet...

Update xsd after changes at structure of table

I got a project where I must fix a lot of bugs, but I have a problem with changing tables. I change type of column from nvarchar 32 to nvarchar 64, and my xsd looks still the same: <xs:element name="MyTableID" msprop:Generator_UserTableName="MyTableID" msprop:Generator_RowEvArgName="MyTableIDRowChangeEvent" msprop:Generator_TableVarName...

Adding elements to editable form using h:dataTable without submitting all the rows

Just wondering if it is possibly to dynamically add elements (in AJAX fashion) to a form using h:dataTable without always submitting the current contents? Normally one has to always send the full contents of the datatable, because the whole datatable is re-rendered. If the datatable gets big (say, 100 rows) this can radically slow down t...

c# custom datatable view.

Can following thing be done? The red rectangled datatable should be modified as the other row. I am using c#, DataTable with MS-SQL. I want to give shown type of view of second row to the user in a windows. I'll be having at least 500-600 rows like this out of 1000 rows. Which can be shorten down to 1000-600/3 = 800. (Perhabs, I can...

How to autoresize the DataGrid Control & DataTable in .net compact framework ?

I am developing mobile application in C#. I am using SQLite as a database. I am using the following code SQLiteDataReader SQLiteDrKeyObj = null; DataTable dt = new DataTable(); DataManager DataMgrObj = new DataManager(); QueryDetails QueryDetailsObj = new QueryDetails(); //int ...

DataTable Concurrency Locking

I'm helping spruce up an application, and it's full of concurrency issues. I'm attempting to work through them, and came across a section that's using DataTables. The datatable itself is static, shared across many threads. I know that using dt.Select("...") itself needs a lock statement, or you'll have issues when adding/removing rows ...

exception while adding multiple rows to datatable. Couldn't store <System.Data.DataRowCollection>

idLocals is Primary key in database Populating the datatable oDtLocalCharge = bll.GetData(); i am copying the datatable in another function dtLocalCharges = oDtLocalCharge.Copy(); and trying to add rows using below code DataRowCollection drr = oDtLocalCharge.Rows; dtLocalCharges.Rows.Add(drr); When i try to add rows to dat...

Finding distinct lines in large datatables

Currently we have a large DataTable (~152k rows) and are doing a for each over this to find a sub set of distinct entries (~124K rows). This is currently taking about 14 minutes to run which is just far too long. As we are stuck in .NET 2.0 as our reporting won't work with VS 2008+ I can't use linq, though I don't know if this will b...