datatable

Set the name of DataTable after it's set

I set 4 datatables as members of my class like this: With retval .LookupData = ConvertArrayToDatatable(engines, ConversionType.Normal) .AdditionalData1 = ConvertArrayToDatatable(drivetrains, ConversionType.Normal) .AdditionalData2 = ConvertArrayToDatatable(transmissions, ConversionType.Normal) .AdditionalData3 = Conv...

Filtering rows of a DataTable with the return type of a DataTable

I would like to filter the rows of a DataTable and then perform a LINQ query on the resulting set of rows. The second query currently operates on a DataTable.AsEnumerable. The DataTable.Select method returns an array of DataRows. Is there anyway to perform a LINQ query on these, or convert a the array of DataRows to a DataTable, so I can...

converting/Casting ISingleResult - List values to DataTable without Looping.

Hi Everyboyd I am using Linq to Sql. When My StoredProcedure Executing its result ll returned in form of IMultipleResults. I am converting it to ISingleResults and It can be Casted as List. So I need to Convert it to DataTable so That I can Bind it to Dataset and Pass the values to UI. But I want such method where I can convert it wi...

Type-ing quesion

Hey everyone, I have a few tables in my database and they all contain a different inherited type of a DataRow. In addition I have a class that is supposed to handle some things in my DataGrid (My database Tables are connected to DataGrids). In order to do that, one of the methods in this DataGrid handler has to cast the rows to the exa...

JSF datatable, request parameters and actions

Hi guys, I'm currently struggling with request parameters in JSF 2 and Icefaces 2 (shouldn't make a difference to only JSF 2) and would like to ask you about the recommended way to handle / process parameters. The problem I encounter occurs when using an ice:dataTable. Every time I hit the submit button (or fire a row selection event by...

trouble in converting Generic List coming from a WCF Service to a DataTable

I am confused on how can I use generic methods to parse generic list into datatable/dataset. My setup: 1. I have a class Customers defined in WCF Service Library. namespace Wcf.Sample.ServiceLibrary { public class Customers { public string ID = string.Empty; public string CompanyName = string.Empty; publi...

C# Bind TextBox To Specific Row Of DataTable

Hello there, I am building a simple C# application that allows the user to edit the rows of a table in a database. The interface is very simple, it is basically a list of rows and a few buttons. Selecting a row and pressing the "Add" button pops up a new form with text boxes for each column. I want those columns to be populated with the...

How to manipulate a table from an Access Database with .NET

I have a table named "Streets" in an access db, and I have opened a connection with OleDbConnection con = OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data source=" + mdbFileName); How can I get at my table? ...

Accessing DataTable.Rows performace decreases over time?

I have a IHttpHandler that I'm using to import an uploaded CSVfile into a database. The class has a static DataTable variable. They first time the handler is run, it opens the CSV file, reads it in to the static DataTable class and closes the file. Each time the handler is accessed after that point it starts a a for loop with the reques...

from datatable to array، no loop

Following Code for transmission to the list box is : DataTable dt = new DataTable(); DataColumn dc = new DataColumn("BestSite", typeof(string)); dt.Columns.Add(dc); for (int i = 1; i <= 10; i++) { DataRow dr = dt.NewRow(); dr[0] = i.ToString() + " = stackoverflow"; ...

Is it possible to figure out WHAT is changing in a RowChanging event?

The DataTable class has RowChanging as well as RowChanged events, which is convenient (for those of us foolish enough to be using the DataTable class in the first place). Event handlers for these events take a parameter of type DataRowChangeEventArgs, whose properties comprise a DataRowAction (Add, Change, Delete, etc.) and the DataRow b...

Join two datatables in a dataset .

I have a dataset, which have two datatables. Can I join these two datatables .I mean a left outer join similar to DB tables ? ...

My .net Datatable returns incorrect results when I select by a float

I have a datatable where one column is a float (a system.single). I'm trying to select the rows where that column ("Radius") is less than or equal to 2.5, but getting silly results. (I get 22 rows returned out of 192, but the Radius column of all those rows are greater than 2.5. I tried all kinds of silly things like putting the value...

DataTable Select filterexpression with not 'between'

I want to filter a datatable with a price range. I want to remove everything that is not between (for example) 2 and 7. In SQL I would do: NOT( price between 2 and 7). But in my filter expression I cannot use the keyword 'between'. What is the best solution? ...

ADO.NET Performance : Which Approach will faster and resonable?

Hi all, I want to select certain amount of data from one table. Based on those data, I want to check another two tables and insert into 2 tables. So I want to iterate the resulted data. Which way is better(faster) and reasonable using DataReader or DataTable? Thanks in advance RedsDevils ...

Fastest way to determine two datatables contain same data?

I want to verify that 2 datatables contains same data (for unit testing), but unfortunately, Assert.AreEqual does not work, it seems that each datatable contains unique metadata that makes their references not equal. How can I do this? ...

Retrieve DataTable info for a table in SQL Server

I need to get the column names, primary keys, foreign keys, and other schema info. The DataTable class seem to contain all of those. Below is the current code I got so far. With it I could retrieve all info except the foreign keys. I'm expecting them to be defined in DataTable.Constraints but they are not. This is my current code: ...

Creating domain model objects from oracle ref cursor

Hi I am using an Oracle Stored procedure that returns ref cursor. Then fill a datatable with that cursor and then iterate datatable and create my model objects. That seems a bit lame and time consuming. What would be a better aproach without using ORM tools of Entity Framework. The other problem with using datatable is that I cant reuse...

Import unique records from datatable to sql table

Hi, I have a datatable matching the structure of a MS Sql table and I would like to import new records from the datatable into SQL. So, in the example below, I am looking to import the record for Jim. DataTable: Name DOB Country Brian 11-11-78 USA Dave 01-01-80 UK Jim 02-02-81 FR SQL: Name DOB Country...

Missing Row in Datatable Modified property

Updating the first record listed in my DataGridView that is bound to my DataTable. When I run Save process I run through this line of code to get all records that have been modified: DataTable modifiedRows = unitDataDT.GetChanges(DataRowState.Modified); If I have changed the first record in my DataGridView my modifiedRows DataTable i...