datatable

Best way to check if column returns a null value (from database to .net application)

I have a table with a DateTime column the column can have NULL values Now I connect to the database using an ODBC connection and get the value into a DataTable in .net / c#. I am able to check it for NULL by going if(String.IsNullOrEmpty(table.rows[0][0].ToString()) { //Whatever I want to do } Is String.IsNullOrEmpty the correc...

Crystal Report just have one line ?

OpenConnect(); OleDbDataAdapter olda = new OleDbDataAdapter("Select * from RECORD where LIC_PLATE='GE 320'", con); DataSet dataset = new DataSet(); olda.Fill(dataset); cr1.SetDataSource(dataset.Tables[0]); crystalReportViewer1.ReportSource = cr1; crystalR...

Data Table to mdb

I have an in memory DataTable in C#. I want to save a local .mdb copy of that on to my file system and retrive it . This C# datatable captures results from an excel formula and saves it. When the same excel file is opened again, I want to have the datatable loaded. This table is like a local cache that I want to reuse. How do i write C...

Simple database table comparison using DataTable.Merge and DataTable.GetChanges

We are converting our application from using Sql Server Express (let's call this version 3) to Sql Server Compact Edition (let's call this version 4). I am trying to make sure that upgrades from previous versions (versions 1 and 2) are the same in the new product (version 4) as the old (version 3). The upgrade code had to be rewritten fo...

Linq to objects from Untyped Datatable Unable to cast object of type 'System.Int32' to type 'System.String'.

Hi, I am completely at a loss for why linq is throwing an Unable to cast object of type 'System.Int32' to type 'System.String' exception. The code is part of a generic function meant to pull the DataTextField and DataValueField out of an untyped DataTable and place them in a list of KeyValuePair(of string, string). I added a for each lo...

Compare Datatables & Merge Changes

I've got two datatables (A, B) with the same structure. I need to compare each row of A with that of B and the resultant Datatable C should have the row in A and the changes of that row in B below it. For rows which are identical (same values in A & B) the resulting Datatable shouldn't have these rows. So the resulting Datatable should ...

text in tables?

Hello, I like to organize a lot of information from literature reviews in "tables" (information not unlike product comparisons, but for scientific research), but often the information I enter can contain lines or paragraphs of text and becomes unwieldy in a spreadsheet. I've heard SQL relational tables are often used for this purpose; fo...

asp.net LINQ vs Datatable

I have datagrid in asp.net page. Also theer are filters and search button for grid. I have following possible option for coding Apply filters for grid inside stored procedure Fetch all data for grid and apply filters + search text using LINQ Fetch all data for grid in datatable and apply filter + search text as a datatable filters. I...

Problem with LINQ in asp.net

Hi, I would like to implement LINQ IN ASP.NET for filter required data from datatable. I have doubt that what is right place. I have following options At presentation layer *.aspx.cs At our Business layer. At our Data base layer, where query for database happen which is return as a datatable to business layer. Business layer then retur...

Dataset / Datatable question - how do I ensure I see updates to my DataTable in real time across parts of my code?

Hi, I'm setting up a Dataset and DataTable in one section of my code. I'm having trouble understanding why update data in one area of my code why I don't see this in another area. I'm doing my best to use the same DataTable as far as I can tell (see code below). What is the minimum I have to do if I want to see new rows that I add in...

Datatable.compute slow with like condition

Hi everyone I have a problem with my asp.net program. I am doing a Datatable.compute on a very large database with a like condition in it. The result takes something like 4 minutes to show or does a Request timeout. If I do the same request with a = and a fix text, it takes nearly 1 minute to show, which for my use is acceptable. Here ...

serializing a datatable for later reuse

Hi everyone, I have a populated DataTable I'd like to serialize to a file for later use. I've been looking over the options involved with this and wondered if someone could point me in the right direction. What I'll be creating are two methods-- one for writing the datatable to a file, and another for creating a new datatable using th...

Howto merge DataTable without copies?

Hello I Have two databases generated from the same SQL code and two datasets created from this databases. I want to create one dataset from this two datasets, and i thought i could do this like this: public void MergeGatunek() { DB1.DataSetGatunek.Tables[0].Merge(DB2.DataSetGatunek.Tables[0], true); DataSetGatune...

Bindind DataTable with silverlight Datagrid

I am writing an app which is to be intranet based .I am trying to use silverlight with Ado.net Just like I write my aspx pages. BUt I have not found how to connect datatable generated from my class directly to my silverlight interfaces. ANy tut that can help me with this. ...

how to return single row using TableAdapter

Hi I am currently using TableAdapter that returns a dataTable, which is fine to use when result table should have more than one row like : MyItemsDataTable myItemsDataTable = Adapter.GetAllItems(); but if we need only one row as a result, say an item, which has a particular ID MyItemsDataSet.MyItemRow itemRow = Adapter.GetItemByID...

DataView.RowFilter an ISO8601

I have a DataTable (instance named: TimeTable) whose DefaultView (instance named: TimeTableView) I am trying to use to filter based on a date. Column clock_in contains an ISO8601 formatted string. I would like to select all the rows in this DataTable/DefaultView between 2009-10-08T08:22:02Z and 2009-10-08T20:22:02Z. What would I have to...

Best practice when converting DataColumn values to an array of strings?

Best practice when converting DataColumn values to an array of strings? [Edit] All values for certain DataColumn for all DataTable rows to be converted to an array of string? ...

how can I add a custom non-DataTable column to my DataView, in a winforms ADO.net application?

Hi, How could I (/is it possible) to add a custom column to my DataView, and in this column display the result of a specific calculation. That is, I currently have a dataGridView which has a binding to a DataView, based on the DataTable from my database. I'd like to add an additional column to the dataGridView to display a number whic...

create a c# datatable object with GUID as identifier?

is this possible instead of an incrementing ID number, I have GUID in the code instead? ...

Exception occuring while using T Field<T> in my code.

I am getting InvalidCastException when i am trying to use this code. I am not been able to resolve how to use Field. Plz help me out DataTable _Transaction= new DataTable(); float NetAmount=0; //Records inserted into Table for (int i = 0; i < _Transaction.Rows.Count; i++) { NetAmount += _Transaction.Rows[...