ado.net

ADO.NET Entity Framework with OLE DB Access Data Source

Has anyone found a way to make the ADO.NET Entity Framework work with OLE DB or ODBC data sources? Specifically, I need to work with an Access database that for various reasons can't be upsized to SQL. This MSDN page says: The .NET Framework includes ADO.NET providers for direct access to Microsoft SQL Server (including Entity Frame...

How can I create valid connection string by using shared memory protocol to connect a named instance of sql server?

How can I create a valid connection string by using shared memory protocol to connect a named instance of sql server while the sql server browser is disabled? ...

(string)reader[0] vs Convert.ToString(reader[0])

what's better var s = (string)reader[0] or var s = Convert.ToString(reader[0]) ? ...

POCO support in ADO.NET Entity Framework?

Hi All, I want to manually map my Entity Classes(POCO) to the Database tables usin ADO.NET Entity framework using the XML mapping file. Is it possible to do so, as I have heard there is no POCO support in ADO.NET Entity Framework for VS2008( AM I Right?).....I want to use POCO classes in my project ad use the entity framework as an ORM....

SQLCommand/SQLConnection vs OleDbCommand/OleDbConnection

Does it make a difference whether I use SQLCommand/SQLConnection instead of OleDbCommand/OleDbConnection. Do I get any advantages out of that, from a API-comfortability-, feature-, performance- or securitly perspective? Or any other perspective? ...

Strategies for replacement of systemic objects

We are currently embarking on replacing the ADO.NET stack in our C# application with Linq. Because the application was not architected with a data abstraction layer, there are ADO calls throughout just about every layer of the application to such a degree that compartmentalizing any one object and trying to convert it to Linq means that...

How to set XACT_ABORT within ADO.NET

How can I set XACT_ABORT to ON (or OFF) from within ADO.NET ? ...

Changing the Name of the Connection String that Entity Framework Uses

How do you change the name of the connection string that Entity Framework models are bound to by default? Let's say I create an Entity Framework data model named "Model1.edmx" by pointing it to a databased named "MyDb" and picking some objects to map using the Visual Studio add new item wizard. The EF model is in a class library project...

Is Explicit Transaction Rollback Necessary?

Many examples out there advocate explicit rollback of database transactions, along the lines of: using (var transaction = ...) { try { // do some reading and/or writing here transaction.Commit(); } catch (SqlException ex) { // explicit rollback transaction.Rollback(); } } Howeve...

SQL Query says a parameter is not supplied, but is added to the SqlCommand object.

I have a stored procedure that has a parameter called UserName and in my code behind I have a SqlCommand object that I add the parameters to with the Add method. But for some reason when the command object tries to run the ExecuteReader method, it throws an exception. I am totally at a loss and have no idea why it's not recognizing the p...

Scope of global temporary table relative to ADO.NET database connection?

SQL Server books online states the following about visibility (scope?) of temporary tables: Temporary Tables You can create local and global temporary tables. Local temporary tables are visible only in the current session; global temporary tables are visible to all sessions. I want to understand how the scope of the global...

Strange DataTable PrimaryKey Behavior

Hi everyone, I have a DataTable that contains several DataColumns, two of which act as the primary key (think OrderDetails from the Northwind database). Here's what it looks like: Dim tblPM As New DataTable("ProductMerchant") Dim dc As DataColumn With tblProducts dc = .Columns.Add("merchantID", GetType(Byte)) dc = .Columns.Add("prod...

Copying a DataTable without using the .Copy method

I have a DataTable that's had people wire into it's different column changed events, ect... I need to clear the table out occasionally and fill it with new data, from a different datatable. I was just using targetTable = sourceTable.Copy(), but then the people above me loose the events they've wired into. I was thinking that I could w...

Is it possible to retrieve connection string inside DDL generation template in VS2010?

I am playing around with creating a T4 template for the "DDL Generation Template option" (model first) process in Visual Studio 2010 RC. Is it possible to retrieve the connection string that is associated with that process? If I right click on the .edmx file and choose "Generate Database from Model..." I have the option of choosing a da...

RIA Services and Relationships in Silverlight 3

I've finally managed to get a handle on loading information using Silverlight, ADO.NET Entities, and RIA Services, but I'm still having a problem with getting the information about the relationships. For instance, imagine a product, and that product has several categories of attributes. We'll call them ProductAreas. The Product object...

ADO.NET Entity Framework Hierarchy type Inheritance Error 3032 Workaround??

I would like to implement a Hierarchy Type Inheritance ... i.e. Cars to BMWs ... Cars would have CarTypeID that is associated with CarTypes. I would like CarTypeID to be the discriminator column. Unfortunately, I cannot do this in ADO.NET Entity Framework. If I would like to keep the association, how am I able to achieve this? Has an...

Entity Framework Code Generation with Indexes

Is there a way to tell .NET 4 ADO.NET Entity's SQL Generator to create indexes for a specific column? ...

ASP.NET Error The conversion of a nvarchar data type to a smalldatetime data type resulted in an out-of-range value.

Hey all I'm trying to do the following insert query SqlDataSource userQuizDataSource = new SqlDataSource(); userQuizDataSource.ConnectionString = "Data Source=localhost\\SQLEXPRESS;Initial Catalog=quizApp;Integrated Security=True"; userQuizDataSource.InsertCommand = "INSERT INTO [UserQuiz] ([DateTimeComplete], [Score], [UserName]) VALUE...

Prevent T-SQL statement from committing application started transaction

I am writing a program that uses ADO.NET's SqlCommand to execute a number of user provided batches of T-SQL statements. My application opens a transaction in which all of the statements are executed to ensure that if there is an error executing any, the whole lot are rolled back. The problem I have come across is that a badly placed CO...

alternate database schema queries in nhibernate

Hi, I am working on an asp.net business application and using nhibernate. My objective of using nhibernate is to minimize/avoid application porting effort on different databases(Oracle, SQL Server, Postgres etc). I have a scenario where i have to dynamically check the database table schema and build some functionality on it. First thing...