ADO.Net Data Services

ASP.Net 3.5 SP1 includes a new concept ADO.Net Data service. Commonly you can ask why we need one more service concept if we have WCF, ASMX services already?. Simply I could write a ASMX or WCF service to  provide API interface for my data. Yes its possible, the problem here is we have to write the code for everything(sorting, filtering, joins, CRUD operations etc) from scratch. Also for supporting different formats(JSON, ATOM, XML etc). Additional code required if we wish to expose it as a RESTful service. ADO.Net data services designed specially for these purpose. In a one go, we can a have service that performs CRUD operations, sorting, filtering etc and provides a RESTful interface supporting ATOM feeds and JSON formats without writing too much code and which well works with Entity Framework. Read more

Importing data into SqlServer from Excel

Excel spreadsheets can be imported into SQL server in various ways. The simple and quickest methods are with using Linked Servers and Distributed queries. The difference is how the connection is used. Linked servers uses a persistent configured connection where as Distributed queries uses a dynamic connection. Linked servers are not suitable when we want to import more than one document. For every document there a linked connection should be configured(painful).

You can configure Linked connection through Server Objects->Linked Servers-> New Linked Connection (See below image) from the Management studio object explorer. Use select statement with OPENQUERY to read excel data. Read more

LinQ to SQL or Entity Framework ?

A common question arises when working with .Net 3.5 data models.

A nice article explaining differences between LinQ to SQL and Entity Framework is at party libraries are available for supporting other databases(like LinQtoOracle etc..).

b) Entity Framework is an ORM DB and is based on application-oriented data model. Its a loosely coupled and may differs from existing DB schema. It represents many:many relations(flexible mapping) and provides different layers to your DB.  Entity Framework works with both SQL Server and 3rd party Databases(.edmx files). If your thinking for a common layer for all the databases, loosely coupled(independent of DB Schema), Entity Framework is the best option.

DataTable Failed to enable constraints error

Recently I constantly encountered ‘Failed to Enable constraints…’ error when working with DataTables. .Net doesn’t provide any detailed information for this error.
This error might be due to
a) Query columns and Fill method columns mismatch
b) Column maxlength exceeded
c) Duplicate rows(when some join)
d) some other when loading data into the DataTable.

Read more