ado.net

How to learn ADO.NET

I need to learn ADO.NET to build applications based on MS Office. I have read a good deal about ADO.NET in the MSDN Library, but everything seems rather messy to me. What's the basics one must figure out when using ADO.NET? I think a few key words will suffice to let me organize my learning....

How do you persist a tree structure to a database table with auto incrementing IDs using an ADO.NET DataSet and a DataAdapter

I have a self-referential Role table that represents a tree structure ID [INT] AUTO INCREMENT Name [VARCHAR] ParentID [INT] I am using an ADO.NET DataTable and DataAdapter to load and save values to this table. This works if I only create children of existing rows. If I make a child row, then make a child of that child, then Update, ...

ADO.NET Connection Pooling & SQLServer

What is it? How do I implement connection pooling with MS SQL? What are the performance ramifications when Executing many queries one-after-the other (i.e. using a loop with 30K+ iterations calling a stored procedure)? Executing a few queries that take a long time (10+ min)? Are there any best practices? ...

[ADO.NET] System.Data.SqlClient.SqlException: Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

Anybody ever get this error and/or have any idea on it's cause and/or solution? I'm asking this on behalf of a friend but there is info at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=125227&SiteID=1 Update The connection string is "=.\SQLEXPRESS;AttachDbFilename=C:\temp\HelloWorldTest.mdf;Integrated Security=True" I sug...

[ADO.NET] What's the deal with |Pipe-delimited| variables in connection strings?

I know that |DataDirectory| will resolve to App_Data in an ASP.NET application but is that hard-coded or is there a generalized mechanism at work along the lines of %environment variables%? ...

[ADO.NET ERRROR]: CREATE DATABASE permission denied in database 'master'. An attempt to attach an auto-named database for file HelloWorld.mdf failed...

Anyone seen this before? CREATE DATABASE permission denied in database 'master'. An attempt to attach an auto-named database for file C:\Documents and Settings\..\App_Data\HelloWorld.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. I'm asking on a friend...

ADO.NET Entity vs NHibernate

So the ADO.NET Entity Framework has gotten a little bit of bad press (in the form of blog entries and a petition) but I don't want to rush to judgement. I'm limited in time for experimentation but I was wondering has anyone worked with it yet with more empirical feedback? Finally, what are thoughts on using NHibernate which has been ar...

ADO.NET Mapping From SQLDataReader to Domain Object?

I have a very simple mapping function called "BuildEntity" that does the usual boring "left/right" coding required to dump my reader data into my domain object. (shown below) My question is this - If I don't bring back every column in this mapping as is, I get the "System.IndexOutOfRangeException" exception and wanted to know if ado.net ...

How do you prevent leading zeros from being stripped when importing an excel doc using c#

I'm able to connect to and read an excel file no problem. But when importing data such as zipcodes that have leading zeros, how do you prevent excel from guessing the datatype and in the process stripping out leading zeros? ...

How can I retrieve a list of parameters from a stored procedure in SQL Server

Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters that belong to a stored procedure on a SQL Server before I actually execute it? I have an a "multi-environment" scenario where there are multiple versions of the same database schema. Examples of environments might be "Development", "Staging", & "Product...

How to Catch an exception in a using block with .NET 2.0?

I'm trying to leverage the using block more and more these days when I have an object that implements IDisposable but one thing I have not figured out is how to catch an exception as I would in a normal try/catch/finally ... any code samples to point me in the right direction? Edit: The question was modified after reading through the re...

Simulating queries of large views for benchmarking purposes

A Windows Forms application of ours pulls records from a view on SQL Server through ADO.NET and a SOAP web service, displaying them in a data grid. We have had several cases with ~25,000 rows, which works relatively smoothly, but a potential customer needs to have many times that much in a single list. To figure out how well we scale ri...

Flex and ADO.NET Data Services...anyone done it?

Has anyone used ADO.NET Data Services as a data source for Adobe Flex applications? If so, any success stories or tragedies to avoid? If you did use it, how did you handle security? ...

Where WCF and ADO.Net Data services stand?

I am bit confused about ADO.Net Data Services. Is it just meant for creating RESTful web services? I know WCF started in the SOAP world but now I hear it has good support for REST. Same goes for ADO.Net data services where you can make it work in an RPC model if you cannot look at everything from a resource oriented view. At least from...

What real-world usages of ADO.NET Entity Framework do you know?

Does anyone have real-world experience with ADO.NET EF? Do you know any project based on this framework? ...

What's the best way to detect if an IDataReader is empty?

It seems like IDataReader.Read() is always true at least one time (If I'm wrong about this let me know.) So how do you tell if it has no records without just wrapping it in a try/catch? ...

What are the disadvantages of Typed DataSets

I come from a world that favors building your own rather than rely on libraries and frameworks built by others. After escaping this world I have found the joy, and ease, of using such tools as Typed DataSets within Visual Studio. So besides the loss of flexibility what else do you lose? Are there performance factors (disregarding the pro...

Anyone using the Entity Framework *Well*?

Has anyone actually shipped an Entity Framework project that does O/R mapping into conceptual classes that are quite different from the tables in the datastore? I mean collapse junction (M:M) tables into other entities to form Conceptual classes that exist in the business domain but are organized as multiple tables in the datastore. All...

How to log in T-SQL

I'm using ADO.NET to access SQL Server 2005 and would like to be able to log from inside the T-SQL stored procedures that I'm calling. Is that somehow possible? I'm unable to see output from the 'print'-statement when using ADO.NET and since I want to use logging just for debuging the ideal solution would be to emit messages to DebugVie...

Old-school SQL DB access versus ORM (NHibernate, EF, et al). Who wins?

I've been successful with writing my own SQL access code with a combination of stored procedures and parameterized queries and a little wrapper library I've written to minimize the ADO.NET grunge. This has all worked very well for me in the past and I've been pretty productive with it. I'm heading into a new project--should I put my ol...