ado.net

Exporting/updating to a data source using a DataSet with a variable schema

I'm using a tree structure in an application I'm writing, and have written recursive methods that will iterate down the tree and populate a number of new DataTables with values. I want to be able to export these tables to a data source, and then later update that data source when the tree or members of the tree change. There are a few ...

Can I avoid the open DataReader exception when using nested commands?

Hi! Can I avoid the open DataReader exception ("There is already an open DataReader associated with this Command which must be closed first.") when using constructs like this one? public void FirstMethod() { using (var command = connection.CreateCommand()) { command.CommandText = "..."; using (var reader = comma...

learning ado.net in c# and looking for good code sample

Hi all, I am trying to learn ado.net. I want to see a real project, real code in 3 layes that works well and written well. I underrstand every part seperatly, I cn't get it right how it all work together tthis why I am asking to download 3 layers winform/wpf solution can anyone help? thanks ...

Entity framework beta only?

Hi, I have Visual Studio Team System 2008 RTM and .NET Framework 3.5 SP1. When I try to install ADO.NET Entity Framework Tools Preview it says: ADO.NET Entity Framework Tools Preview can only be installed if at least one of the following Microsoft Visual Studio 2008 Beta 2 products is installed: Visual Basic 2008 Beta 2 Exp...

Is there a limit to the number of DataColumns I can add to a DataTable?

I can't find any references to there being a limit to the number of DataColumns I can add to a DataTable. The DataTable will not be generated from a SQL query, but rather synthesized from other data. Thanks, Matthew ...

Fill an array (or arraylist) from SqlDataReader

Is there a way to fill an array via a SqlDataReader (or any other C# ADO.NET object) without looping through all the items? I have a query that is returning a single column, and I want to put that into a string array (or ArrayList, or List, etc). ...

Where i put the Connectionstring with numerous client?

Hi everybody, i will develop utility program for a company with more than 1000 client and the program must be win application with .Net because my program will act with another program. What is your suggest for place of app.config? one scenario: We put the app.config on the server that configured once and write a windows service for it t...

SQL Server and .NET: insert fails (silently!) in code but not when run manually

My insert stored procedure: ALTER procedure proj_ins_all ( @proj_number INT, @usr_id INT, @download DATETIME, @status INT ) as INSERT INTO project (proj_number, usr_id, date_download, status_id) VALUES (@proj_number, @usr_id, @download, @status) select SCOPE_IDENTITY() ... runs fine when called manually like so: exec proj_ins_al...

How to format the result set of parent child records?

All, I have a result set coming from several SQL Server tables, and I need to know what the best way to get the sorted records I need would be. I have the following records; a user name and module number as parent records, and then for each of these modules there are multiple sub-module child records. The problem I'm having is that the...

Auditing in Entity Framework.

After going through Entity Framework I have a couple of questions on implementing auditing in Entity Framework. I want to store each column values that is created or updated to a different audit table. Rightnow I am calling SaveChanges(false) to save the records in the DB(still the changes in context is not reset). Then get the added ...

Maximum size for a byte[] in a .Net DataSet/DataTable

Is there any maximum size for a cell of data in a DataTable (like a byte[]), or can you grow it until the system runs out of memory? ...

How to handle exceptions generated by DataSets?

Hi, DataSets in ADO.Net throw exceptions when there are constraint violations etc. It is easy to catch these exceptions in the WinForms UI Layer using DataGridView (using DataError event). However, I am unable to find a way to catch and handle these exceptions when using simple data bound (to datasets) controls such as textboxes. Any i...

ADO.NET asynchronous reader (queue processing)

I have a large table, 1B+ records that I need to pull down and run an algorithm on every record. How can I use ADO.NET to exec a "select * from table" asynchronously and start reading the rows one by one while ado.net is receiving the data? I also need to dispose of the records after I read them to save on memory. So I am looking of a ...

What's the recommended way to start using types from a returned DataRow in C#?

When looping through a DataRow and encountering types such as DataRow dr; dr["someString"] dr["someInteger"] dr["somedata"] What's the best way to get them into their corresponding data types? dr["foo"] is just a generic object. Also, are these able to be easily converted to nullable types? dr["someInteger"] could be null. ...

How to Get Records to Display in the way I need

All, I have a result set with a parent "YourName" record and parent "module_viewed" records. I also have multiple child records, "modules_completed" per parent record. What I need is to be able to display in one horizontal row "YourName", "module_viewed", and then the several "modules_completed" records associated with each of these pa...

Derived fields in ado.net entity framework

I have a persistent class that looks like this: public partial class Unit { public string Name { get; set; } public long LengthInMM { get; set; } public decimal VolumeCoefficient { get { return LengthInMM * LengthInMM * LengthInMM; } } } Now the derived field (VolumeCoefficient) never gets explicitly ass...

OleDbCommand with Update $OleDbParameter: why parameters should be in same order as sql ?

OleDbCommand cmd = new OleDbCommand("UPDATE mytable SET " + "col2=@col2 WHERE col1=@col1", connection); cmd.Parameters.Add(new OleDbParameter("@col1", "col1")); cmd.Parameters.Add(new OleDbParameter("@col2", "col2")); won't work because it should be cmd.Parameters.Add(new OleDbParameter...

How DataReader works???

Hi, I was thinking that the SQLDataReader should not work if there is no connection to the SQLServer. I experimented this scenario. I execute the ExecuteReader then stop the SQLServer Service and tried to iterate through the DataReader. What I expected was an exception, but it gave the results one after the other. Ideally the DataReade...

Tutorials on connected data access architecture of ADO.Net?

Hello as I read here http://www.programmersheaven.com/2/FAQ-ADONET Disconnected architecture is not well suited for desktop clients with multiple updates but most tutorials are oriented towards disconnected ado.net would like to see tuts on connected data access architecture. So any links ? Thanks. ...

What is the state of ado.net entity framework?

I get the impression that Microsoft is putting a significat investment into this framework, conversely I have heard the who's who (who?) of the object relational professionals think it sucks, and I have to agree. I have asked a simple question a while ago and I do not think it is unsolvable, given the commonality of that problem it shoul...