ado.net

Comparing hand-written ADO/Sprocs w/nHibernate

Hi, I am going back and forth between using nHibernate and hand written ado.net/stored procedures. I currently use codesmith with templates I wrote that spits out simple classes that map my database tables, and it wraps my stored procedures for my data layer, and a thin business logic layer that just calls my data layer and returns the...

paged data using a CTE, how would nHibernate handle this?

Hi, I use CTE to handle paging of data currently, can criteria queries handle CTE? ...

Default sizes for SQL parameters in ADO.NET

There are multiple overloads for sqlcommand.Parameters.Add(...) function. Some of them do not take size, and some do. What sizes are set by default? Is it safe not to set parameter sizes? Does it affect performance? ...

Dynamic Data Web Application give me error?

İ try to work Ado.net Entity Framework with dynamic Data web Application But My solution run wthout error But Click gridview items create me : Server Error in '/' Application. The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'. ...

Inherited Tables Not Accessible In ADO.NET Data Services

I am currently working on a project where I create a Data Service based on an Entity Data Model. In my Entity Model I have several inherited entities (Such as Orders (Base), Prescriptions (Inherited)). From my data services I am having a problem through the data service where I can't reference the inherited type (prescriptions) only th...

How to update a large table using ADO.NET

Ok, so here's the problem I have to solve. I need to write a method in C# that will modify a table in SQL Server 2008. The table could potentially contain millions of records. The modifications include altering the table by adding a new column and then calculating and setting the value of the new field for every row in the table. Adding...

How can I get a DataRow from a NHibernate ISQLQuery query?

I need a DataRow with every column of a table T without the column Y, which holds the primary key. The SQL is: SELECT * FROM T WHERE Y=N LIMIT 1 "LIMIT 1" is a mysql dialect so that is the reason I need an agnostic ISQLQuery (query.SetMaxResults(1);) to do the work. I can get a row in the form of object[] using this code: ISQLQuer...

Is it possible to run native sql with entity framework?

I am trying to search an XML field within a table, This is not supported with EF. Without using pure Ado.net is possible to have native SQL support with EF? ...

How should I design my datalayer so I could potentially swap out nHibernate with linqToSql?

So I'm going with nHibernate, but want to design my datalayer so I could potentially swap out (or switch) to a linqToSql layer. How should I go about designing this? Should I make an interface that has all my database calls? Something like this? GetUser(); InsertUser(); ...

Can you use DataTable.Contains(object key) if your datatable's primary key is two columns?

if so how? ...

SqlDataReader Column Ordinals

Suppose I am calling a query "SELECT name, city, country FROM People". Once I execute my SqlDataReader do columns come in the same order as in my sql query? In other words can I rely that the following code will always work correctly: SqlConnection connection = new SqlConnection(MyConnectionString); SqlCommand command = new SqlCommand(...

Read an in-memory Excel file (byte array) with ADO.NET?

I want to use ADO.net to extract some data from an Excel file. This process is pretty well documented on the internet. My catch is that my file has been uploaded by a user, and so exists only as a byte array in memory. For security and performance reasons I would rather not write this file to disk. Is there a way of constructing a conne...

How do I avoid these deadlocks?

I have a routine which is updating my business entity. The update involves about 6 different tables. All the commands are being executed within a transaction. Recently, I needed to add some code into the routine which accesses a lookup table from the database. The lookup code already existed in another business object so I used that ...

Relational table copy with transformation in most generic way ( declarative rules and etc... ) - Microsoft sandpit

I guess, it is quite common task. There is a table A let's say in Visual Foxpro and needs to be transformed to table B in SQL Server 2008. Operation is going to be repetitive. Column names may be changed , some input columns dropped , column types may be changed ( string <=> int ), some output columns generated ( GUID , identity ) . Als...

Entity Framework with NOLOCK

How can I use the NOLOCK function on Entity Framework? Is XML the only way to do this? ...

Ado.Net entity framework, linq: select multiples tables

Hello! I use these sentence in C# to retrieve data from tables DetalleContenido and Archivo: var detallesContenido = from contenido in guiaContext.Contenido where contenido.PuntoInteres.id_punto == puntoInteresID from dc in contenido.DetalleContenido where dc.Idioma.ds_idioma == idiomaCliente select dc; The relati...

In C# what is the best way to determine if a database is up and running?

I have come up with the following method to determine is a database is up and running. This trys to open a database connection and if it fails it return false. private static bool IsDatabaseConnectionUp(string connectionString) { System.Data.SqlClient.SqlConnection conn = null; try { conn = new SqlConnection(connec...

How do I bulk insert with SQLite?

How do I bulk insert with SQLite? I looked it up and it seems like I do an insert with a select statement. I googled, looked at the examples and they all look like they are copying data from one table to another or is not compatible with SQLite. I want to do something like "INSERT INTO user_msg_media (recipientId, mediaId, catagory, cu...

ADO.NET Entity Framework: How to get auto cascading deletions?

I am using the Ado.Net Entity Framework with ASP.NET MVC. In my MSSQL 2008 Database I have for example the following simplified tables and relations: (Song) 1--* (Version) 1 -- 1 (VersionInfo) Is it possible to automatically have the linked Versions and their VersionInfo's deleted when I delete a Song? Currently I am using somethin...

Problem with repository creation in C# and ADO.NET entities

Hi everyone, I'm building this app at night after work and have been struggling with this design problem for a week or two now. I'm building a program that has 44 different types of entries and requires the ability to create a custom type. Because users might change the fields in a particular type of entry and/or define their own, my ...