dataset

Which controls are bound to my dataset?

Given a DataSet instance, is there any way I can find out which controls are bound to it's tables? I want to stop everything binding to the DataSet, something like : foreach (Control cont in dataset.ControlsBoundToMe) { if (cont is DataGrid) { (cont as DataGrid).DataSource = null; } } Thanks ...

Which DataSet creation technique is faster?

Which one of these techniques is faster? 1) DbDataAdapter dataAdapter = _factory.CreateDataAdapter(); dataAdapter.SelectCommand = _command; dataSet = new DataSet(); dataAdapter.Fill(dataSet); 2) DataTable dt = new DataTable(); IDataReader iDataReader= _command.ExecuteReader(); dt.Load(iDataReader); iDataReader.Close(); ...

DataTable to List<T> conversion problem

While executing this method: public static List<T> ToList<T>(DataTable dataTable) { Type type = typeof(T); List<T> list = new List<T>(); foreach (DataRow dr in dataTable.Rows) { object[] args = new object[1]; args[0] = dr; list.Ad...

ASP.NET MVC 1: DataSet ModelBinding

I'm in a situation where I'm being given a dataset to output to an MVC view. I'm really struggling to figure out how to get the modelbinder to pick it up on the way back in after a submit. I have something like this... public ActionResult TestData() { DataSet data = new DataSet("DS"); DataTable table = new DataTable("DT"); ...

xsd.exe creating invalid constraints in dataset from xsd file

I have a sequence with an allowed minimum length of zero in my xsd. When I try and load an xml file which doesn't have any elements of the sequence into the DataSet that xsd.exe created I get an exception indicating that my file violated one of the DataSet's constraints. The xml file validates against the schema so I know it's valid. ...

Query a DataSet

I'm reading data from xml files into a strong typed DataSet. The data ends up in multiple tables; can I run queries against it to create a denormalized view to display in a DataGrid? Sample input: <PeopleFile> <address> <street>123 some street</street> <town>anytown</town> <resident> <first>Jane</first> <last>Doe</last> ...

DataSet Operations

I'm working with DataSets, specifically with a an array of DataRows: My question is, how am I able to perform Unions/Intersects of DataRow[]'s WITHOUT using LINQ? ...

Can I use a query designer to write Linq Queries against a DataSet

I've got a DataSet created by the xsd.exe tool to import some xml files, and need to denormalize the data within for display purposes. Instead of writing linq to dataset queries by hand is there any way I can access the tables within a query builder wizard? ...

Combine Data from multiple DataSets

I'm loading data from multiple xml files with different schemas into DataSets. I do have foreign key style relationships between the tables in each xml file but to date they're only enforced by code. I need to access data coming from multiple files and display it in a DataGridView. Is there a way to merge the data from multiple file...

IQueryable into a hierarchy

I currently have an IQueryable of Questions. In my Question object I have and "id" and a "parentId" which can be used to create a hierarchy. Currently, I bind a RadTreeView to the IQueryable of Questions and the RadTreeView takes care of creating the hierarchy because I define the dataId and dataParentId for the TreeView in the markup....

.NET DataSet.GetXml() - what's the default encoding?

Existing app passes XML to a sproc in SQLServer 2000, input parameter data type is TEXT; The XML is derived from Dataset.GetXML(). But I notice it doesn't specify an encoding. So when the user sneaks in an inappropriate character into the dataset, specifically ASCII 146 (which appears to be an apostrophe) instead of ASCII 39 (single q...

DataSet generated by xsd.exe is not writing attributes on root element

Child elements of my data are being written directly off the root element instead of off the element that is their parent in the schema. My xsd: <xs:schema xmlns="MyNameSpace" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="MyNameSpace" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> <xs:i...

Can I change the indenting style used when saving a DataSet to xml

I'd like to use tabs, or at least more than 2 spaces per indent level. IIRC there are options available to adjust this when using serialization to write a class out; but I don't see any way to adjust the behavior when calling MyDataSet.WriteXml(filename). ...

Import typed DataSet to SQL Server

Dear guys I want to import a typed DataSet with DataTables (not with TableAdapters) to my SQL Server database. The structure of all DataTables in the DataSet is the same like in the SQL Server database. With the same fields. How can I import the whole typed DataSet to my SQL Server database? Best regards ...

How to retrieve a list of tableadapters?

BACKGROUND: Most of my programs use table adapters, and the connection strings are stored in app settings. This works fine, but was a real PITA when switching from development to production environment. I had to change manually the connection strings before and after starting my work on any app. After a bit of research I found how to sw...

Object To DataView or DataSet or DataTable and back to object

We have a mish-mash app with a legacy module that still uses DataSets, DataViews and DataTables however we have most of the the databases ORMed except the DB for this Module. I was wondering if someone could give me pointers as to how to go about building extensions like /* generates a dataset called CustomerDS with DataTable called Cu...

How to fill a dataset after getting a gridview?

I have a gridview which has many columns.. the columns are got separately and displayed in a gridview. now i need to sort this gridview but i cannot do that.... i have found a way but i will need to get the gridview in a datatable or a dataset.... is there a a way to do this? DataSet ds= new DataSet(); ds = Gridview1.???? please help...

Repeated use of elements in a schema and XSD.exe generated datasets.

My schema looks like this: <xs:schema xmlns="DAN" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="DAN" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> <xs:complexType name="Stuff"> <xs:sequence> <xs:element ref="Numbers" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:element ...

knowing if a string will be truncated when updating database

I'm working on a software that takes a csv file and put the data in a sqlserver. i'm testing it with bad data now and when i make a data string to long (in a line) to be imported in the database i got the error : String or binary data would be truncated the statement has been terminate. that's normal and that's what i should expect. Now ...

Binary stream 'NN' does not contain a valid BinaryHeader. Possible causes are invalid stream or object version change between serialization and deserialization

I am passing user defined classes over sockets. The SendObject code is below. It works on my local machine, but when I publish to the WebServer which is then communicating with the App Server on my own machine it fails. public bool SendObject(Object obj, ref string sErrMsg) { try { MemoryStream ms ...