datatable

Modifying a DataTable

Situation: Hello! I am trying to populate a WPF toolkit DataGrid with a MS Access database. Here is what I have right now (it works): //Load the datagrid with the database private void LoadDataGrid(string filename, string path) { string databaseConn = "Provider=Microsoft.ACE.OLEDB.12.0;" + ...

DataTable Select: Expression with a space problem...

Situation: Hello! I have a little problem in a C# project. I am using the Select method from a DataTable object and using an expression to get what I want but I am having some trouble with a space in one of the strings I am using for the expression. So here is a code sample of what I have: DataTable table; //... DataRow[] rows = tab...

Winforms DataTable Convert to Excel

In asp.net, it is quite easy to convert a datatable to an excel file. How do I do the same for datatables in winforms? For Example: in my asp.net code, here is my function to convert the datatable to excel: Public Shared Sub DataTableToExcel(ByVal dt As DataTable, ByVal FileName As String HttpContext.Current.Response.Clear() Http...

IEqualityComparer GethashCode method

Hi, My datatable contains the following columns... resultsView.Columns.Add("Fam.", typeof(string)); resultsView.Columns.Add("Component", typeof(int)); resultsView.Columns.Add("Description", typeof(string)); resultsView.Columns.Add("Quantity", typeof(double)); resultsView.Columns.Add("Unit", typeof(string)); resu...

WCF streaming mode issue

Hello everyone, I am hosting a WCF service in IIS using basicHttpBinding using streaming mode. The WCF web services queries back end SQL Server 2008 by using ADO.Net and return a DataTable to client side of WCF service. My understanding of WCF streaming mode are, WCF streaming mode should use only constant number of memory at both cl...

Synchronizing DataGridView (DataTable) with the DB

Hi! I have the following situation: there is a table in the DB that is queried when the form loads and the retrieved data is filled into a DataGridView via the DataTable underneath. After the data is loaded the user is free to modify the data (add / delete rows, modify entries). The form has 2 buttons: Apply and Refresh. The first one ...

How to save a table(DataTable) into a single cell in a database?

Is it possible to save a DataTable into SQL database in one cell of type binary for example and read it back again into a DataTable? ...

strange out-of-memory exception during serialization

Hello everyone, I am using VSTS2008 + C# + .Net 3.5 to run this console application on x64 Server 2003 Enterprise with 12G physical memory. Here is my code, and I find when executing statement bformatter.Serialize(stream, table), there is out of memory exception. I monitored memory usage through Perormance Tab of Task Manager and I fin...

YUI Datatable: custom column definitions and data

Hi, I am trying to use the YUI datatable to display data from a JSON object which looks like this: {"results":[{"label":"Column 1","notes":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. "},{"label":"Column 2","notes":"Lorem ipsum dolor sit amet, consectetur adipiscing elit."},{"label":"Column 3","notes":"Lorem ipsum dolor si...

c# datatable is populated, need help printing particular data to a report

what can I do on the reporting side, not the sql, or the c# part of the problem? my query returns four rows, grouped by the field payment_type, then puts the results into a datatable that's connected to my report in c#. What can I do on the report side to pull a specific row out of the datatable where payment_type="Cash" without modify...

refresh single cell in yui datatable

I am using a yui datatable to show tabular data with certain fields that update in real timee. All examples I've seen require that the entire table be re-drawn even if only one column of data has been changed. Obviously this causes problems with both client-side sorting and scrolling and adversely affects UI performance as well. Is th...

Save a datatable to excel sheet in vb.net winform application

A year ago I saw a beautiful simple code that gets a data table and saves it in an excel file. The trick was to use the web library (something with http) and I'm almost sure it was a stream. I find a lot of code with response but I can't make it work in a win-form environment. There is also a cell by cell code - not interested -too sl...

Using a DataTable object with Silverlight

I have an interesting problem: I can get results back from my WCF service to my Silverlight code as a DataTable. Problem is, Silverlight doesn't support DataTable objects. I've been poking around with what I can do, and the best I can come up with is passing it back as a List. Great, right? Nope. Now I'm getting the same problem as ...

updating in database only those updated records in datatable

Hi, I'm using Updaterow_event handler for grid where in I update cells in the grid and therby gets updated in the datatable also... I have a button which i click after updating cells in the grid so that inside button_click event i'm writing code to update in Database.. I've a problem here... I dont know how to access only those record...

Adding a Column of one datatable to another

Hey all need a lil help sorting a loop for this table out, cant seem to apply a working example to the model, anyway here it goes. I have 2 datatables, each with different data and different values, the only value in common is the date. The first table has everything I want in it except a single column of values (from the other table) S...

Populating object from datatable

I am populating the customer object as shown below. How do I write condtions as shown below in for eg. If isdbNull(.age) then .age=10 else .age=dr("age") end if Public Shared Function Retrieve() As List(Of Customer) Dim dt As DataTable = Dac.ExecuteDataTable( _ "CustomerR...

How to modify data within datatable in C#

Hi, I'm using Visual Studio 2008 (Asp.net (c#)) and SQl Server 2005 I have a datatable ("dtReportList") generated from database query and then I show the datatable by a gridview. dtReportList = GetReportList(UserId); //get data from database GridView1.DataSource = dtReportList; GridView1.DataBind(); The output data of datatable will ...

ColumnChangeEvent not fired for calculated columns

How can I be notified when a calculated column value changes ? ...

Can I add the same DataRow to a DataTable multiple times?

If I have a DataTable and want to create a new row I first call DataTable.NewRow() which returns a DataRow. This row then has the schema of the Table, and I can set the value of each field in the row. At this point does the Table "know" about the Row, or does that only happen after I call DataTable.Rows.Add(DataRow row)? If I call D**at...

.Net DataView and DataTable Binding

I have a simple Windows Forms application which binds a DataView to a ListBox. This DataView uses Linq to sort my DataTable by a specific column descending. My ListBox is then bound to the DataView. I then have a simple form to add data to the DataTable. When I add a DataRow to the DataTable it displays in the ListBox. I'm curious as to...