datatable

Consuming Database Result Sets with Silverlight DataGrid

So I have a WCF Service that gets a result set from a database (not SQL) - I can get this data as a DataTable, string[][], etc. I can't use LINQ or ADO.NET Entity Framework very easily as it's not coming from an SQL DB. So my question is: -What's the best way to package this data for transmission across the wire? I can use any data...

Filer DataTable to exclude DBNull.Value

I receive a DataTable from excel file and data in the first Column looks like this: 11129 DBNull.Value 29299 29020 DBNull.Value 29020 I'm using LINQ to select distict and it works if there are no DBNull.Value values as below. albumIds = dt.AsEnumerable().Select(p => (int)p.Field("F1")).Distinct().ToArray(); But if DBNull.Value p...

Problem with paging with Linq and DataTable

Hi, I'm writing a small web app in VB.NET and I would like to do paging for my DataTable in the following function : Public Shared Function Testing(ByVal KeyWord As String, ByVal CurrentPage As Integer, ByVal PageSize As Integer) As DataTable Dim db As New BibleDataClassesDataContext Dim dtDataTableOne = New DataTable...

DataTable column sort in ASCII order, not

If I have two strings, and I need to compare them in ASCII order (instead of the invariant culture order) I can generally use: int c = String.Compare(a, b, StringComparison.Ordinal); If I have a DataTable, and I want one of the columns sorted using an Ordinal string comparison for the DataView , how do I go about it? ...

Easiest way to copy a dataview to a datatable in C#?

I need to copy a dataview into a datatable. It seems like the only way to do so is to iterate through the dataview item by item and copy over to a datatable. There has to be a better way. ...

Linq over DataTable with .Skip() and .Take() method

Hi, I have this function that returns a DataTable : Public Shared Function GetDataTable(ByVal PageSize As Integer, ByVal CurrentPagea As Integer) As DataTable Dim dtData As New DataTable dtData = da_Book_Content.GetDataContent() 'TODO : how to do data paging for dtData with Linq Return dtData End Function On a pa...

Shared values in column between datatables in ado.net

I'm using c# and i have three datatables, all three have an int column named idnum, what i need is to keep all numbers in the column idnum unique in the three tables and the next number will always be the small available. For example: table a idnum=1 idnum=3 idnum=4 table b idnum=2 idnum=7 table c idnum=8 in this case the n...

ASP.Net Data Driven Website Efficiency

Hi, I'm creating an ASP.Net website that displays large amounts of data. The data is served to me through a data access layer. From the data I'm getting I'm building up large data tables and then displaying these using either gridview's or dynamically created web controls. The problem I'm finding is that the website is slow when a lot...

Column does not exist in table error

Hi, I perform a set of operations on a dataset table: MyDataSet sharedDS = new MyDataSet(); MyDataSet referenceDS = new MyDataSet(); sharedDS.Table1.Reset(); sharedDS.Merge(referenceDS); I get a System.ArgumentException: Column_X does not exist in Table1 if I try to access the column this way: MyDataSet.Table1.FindByKey().Column_X...

XML Schema for class containing a DataTable

I have one class which has field of type DataTable. I want to write XSD for this class. My problem is the datable structure is not fixed. The columns are added dynamically. How to write XSD for such a class? Once the XSD is defined, I want to validate the class serialized to XML against the XSD. ...

Any way to shorten or simplify the item template markup for a repeater control?

Is there a way to shorten the markup for this repeater? I am binding a DataTable to this repeater. It bothers me because ((System.Data.DataRowView)Container.DataItem) is repetitive and makes the markup less readable especially when you have more fields. I am using .Net 3.5 C# WebForms. MVC is not an option. Thanks. <asp:Repeater ID...

Without joins on Google App Engine, does your data have to exist in one big table?

Since Google App Engine doesn't permit joins, does this mean that I have to take all of the tables in my web app and figure out a way of combining them into a single huge table? ...

how to query strongly type datatable

Hi, I have a news portal. For this portal I have a database with a "News" table and with the following columns (NewsID, CategoryID, NewsTitle, NewsText, DateAdded, ImagePath, TotalRead, NewsType, isActive) I use dataset files (.xsd) and for this one, I have a query that returns the last 3 days' news into a custom class that I coded, ...

DataTable Select() with Guids

I am trying to boild my treeview at runtime from a DataTable that is returned from a LINQ query. The Fields returned are: NAME = CaseNoteID | ContactDate | ParentNote TYPE = Guid | DateTime | Guid The ParentNote field matches a entry in the CaseNoteID column. The Select(filter) is giving me a runtime error of Cannot find col...

Using ASP.NET MVC without an ORM

In my ASP MVC application I'm using standard SQL (rather that Linq to SQL or other ORM) to query my database. I would like to pass the database results to my view and iterate over the results in my view. But I'm not sure how to do this. Every example I've seen passes some string or uses L2S. I would like to pass something like neste...

Setting DataRow as ComboBox's value member

Hello! I am filling items to my ComboBox from a XML file using a DataTable. Currently I have it set so that one column is ComboBox's displaymember and another is it's value member. However this may not always work for me, since I have to set the selectedItem parameter, and value member may not be unique. I don't know if there is a dupl...

Should AcceptChanges() be called every time a new row is added?

Which is recommended while (reader.Read()) { table.Rows.Add( new object[] { reader[0], reader[1], reader[2], reader[3] } ); table.AcceptChanges(); } or while (reader.Read()) { table.Rows.Add( new object[] { reader[0], reader[1], reader[2], reader[3] } ); } table.AcceptChanges(); ...

Allowing a user to create a custom query of a table

I am writing a program that generates a single large table of information. The table is made up of two types of columns, columns that contain quantities, and columns that contain properties. Quantities are numeric values that can be summed, properties are qualitative values that attribute the quantity values. If the data is in a table i...

In WPF/Silverlight: Is it possible to bind a DataTable or an XML file to a ListView?

Is it possible in WPF to bind a data matrix (data table or an XML file) to a ListView? Given the following XML dataset: <data> <cols> <col name="FirstName" /> <col name="LastName" /> <col name="Age" /> </cols> <rows> <row> <col>Huey</col> <col>Freeman</col> <col>10</col> </row> <row> ...

C# XMLDocument to DataTable?

I assume I have to do this via a DataSet, but it doesn't like my syntax. I have an XMLDocument called "XmlDocument xmlAPDP". I want it in a DataTable called "DataTable dtAPDP". I also have a DataSet called "DataSet dsAPDP". - if I do DataSet dsAPDP.ReadXML(xmlAPDP) it doesn't like that because ReadXML wants a string, I assume a file...