ado.net

How do you create a database from an EDM?

How do you create a database from an Entity Data Model. So I created a database using the EDM Designer in VisualStudio 2008, and now I want to generate the SQL Server Schema to create storage in SQL Server. ...

ADO.NET Entity Framework tutorials

Does anyone know of any good tutorials on ADO.NET Entity Framework? There are a few useful links here at Stack OverFlow, and I've found one tutorial at Jason's DotNet Architecture Blog, but can anyone recommend any other good tutorials? Any tutorials available from Microsoft, either online or as part of any conference/course material? ...

Handling empty values with ADO.NET and AddWithValue()

I have a control that, upon postback, saves form results back to the database. It populates the values to be saved by iterating through the querystring. So, for the following SQL statement (vastly simplified for the sake of discussion)... UPDATE MyTable SET MyVal1 = @val1, MyVal2 = @val2 WHERE @id = @id ...it would cycle through t...

Output parameters not readable when used with a DataReader

When using a DataReader object to access data from a database (such as SQL Server) through stored procedures, any output parameter added to the Command object before executing are not being filled after reading. I can read row data just fine, as well as all input parameters, but not output ones. [This question is actually just for anyo...

What is the best data access paradigm for scalability?

There are so many different options coming out of microsoft for data access. Which one is the best for scalable apps? Linq Should we be using Linq? It certainly seems easy but if you know your SQL does it really help. Also I hear that you can't run Async queries in ASP.NET using Linq. Therefore I wonder if it is really scalable? Are th...

Copying data from one DataTable to another

What is the fastest way of transferring few thousand rows of data from one DataTable to another? Would be great to see some sample code snippets. Edit: I need to explain a bit more. There is a filtering condition for copying the rows. So, a plain Copy() will not work. ...

Astoria vs. SQL Server Data Services

What are in your opinion big differences between areas of usage for "Astoria" (ADO.NET data services) and SQL Server Data Services? ...

Using MySQL with Entity Framework

Can't find anything relevant about Entity Framework/MySQL on Google so I'm hoping someone knows about it. ...

Troubleshooting Timeout SqlExceptions

I have some curious behavior that I'm having trouble figuring out why is occurring. I'm seeing intermittent timeout exceptions. I'm pretty sure it's related to volume because it's not reproducible in our development environment. As a bandaid solution, I tried upping the sql command timeout to sixty seconds, but as I've found, this doe...

How to convert Typed DataSet Scheme when one of the types was changed?

I got a typed (not connected) dataset, and many records (binary seriliazed) created with this dataset. I've added a property to one of the types, and I want to convert the old records with the new data set. I know how to load them: providing custom binder for the BinaryFormatter with the old schema dll. The question is how can I convert...

Excel column names

What column names cannot be used when creating an Excel spreadsheet with ADO. I have a statement that creates a page in a spreadsheet. CREATE TABLE [TableName] (Column string, Column2 string); I have found that using a column name of Date or Container will generate an error when the statement is executed. Does anyone have a complete ...

How can I tell how many SQL Connections I have open in a windows service?

I'm seeing some errors that would indicate a "connection leak". That is, connections that were not closed properly and the pool is running out. So, how do I go about instrumenting this to see exactly how many are open at a given time? ...

Connection Timeout exception for a query using ADO.Net

Update: Looks like the query does not throw any timeout. The connection is timing out. This is a sample code for executing a query. Sometimes, while executing time consuming queries, it throws a timeout exception. I cannot use any of these techniques: 1) Increase timeout. 2) Run it asynchronously with a callback. This needs to run in a...

Entity Framework: how to return a base type from L2E

Considering the following architecture: a base object 'Entity' a derived object 'Entry:Base' and a further derived object 'CancelledEntry:Entry' In EntitySQL I can write the following: [...] where it is of (only MyEntities.Entry) [...] to return only objects of type Entry and no Entity or CancelledEntry. In linq to sql, the foll...

Is it possible to send a collection of ID's as a ADO.NET SQL parameter?

Eg. can I write something like this code: public void InactiveCustomers(IEnumerable<Guid> customerIDs) { //... myAdoCommand.CommandText = "UPDATE Customer SET Active = 0 WHERE CustomerID in (@CustomerIDs)"; myAdoCommand.Parameters["@CustomerIDs"].Value = customerIDs; //... } The only way I know is to Join my IE...

How do I automatically update a ModifiedAt field with ADO.NET Entity Framework?

Ruby on Rails has magic timestamping fields that are automatically updated when a record is created or updated. I'm trying to find similar functionality in Entity Framework. I've considered database triggers and a SavingChanges event handler. Is there a more obvious method I'm overlooking? ...

Point ADO.Net DataSet to different databases at runtime?

I have a large ADO.Net dataset and two database schemas (Oracle) with different constraints. The dataset will work with either schema, but I want to be able to tell the dataset which schema to use (via connection string) at runtime. Is that even possible? ...

What Exception should be thrown when an ADO.NET query cannot retrieve the requested data?

In an attempt to add some parameter validation and correct usage semantics to our application, we are trying to add correct exception handling to our .NET applications. My question is this: When throwing exceptions in ADO.NET if a particular query returns no data or the data could not be found, what type of exception should I use? Psue...

Synchronize a DataSet and DataTables with Database

I am using ADO.net with a DataSet and DataTables for the first time and I have run into a pretty significant problem. Each time that I change anything in my database table definitions, I don't seem to have an easy way to synchronize these changes to my DataTable definitions in my DataSet. So far, it has been quick to simply delete my Da...

MS Access Data Access Limitations

I have a project right now where I'd like to be able to pull rows out of an Access database that a 3rd party product uses to store its information. There will likely be a small number of users hitting this database at the same time my "export" process does, so I'm a little concerned about data integrity and concurrent access. Will I li...