Questions tagged [ado.net]

ADO.Net is commonly used by programmers to access and modify data stored in relational database systems, though it can also access data in non-relational sources. It is a part of the base class library that is included with the Microsoft .NET Framework.

ADO.NET is a set of computer software components that programmers can use to access data and data services. It is a part of the base class library that is included with the Microsoft .NET Framework.

It is commonly used by programmers to access and modify data stored in relational database systems, though it can also access data in non-relational sources. ADO.NET is sometimes considered an evolution of ActiveX Data Objects (ADO) technology, but it was changed so extensively that it can be considered an entirely new product.

In modern practice, ADO.NET is often implemented along side the query language LINQ, and the Entity Framework (Microsoft's OR/M persistence layer).

10075 questions
793
votes
24 answers

How do I view the SQL generated by the Entity Framework?

How do I view the SQL generated by entity framework ? (In my particular case I'm using the mysql provider - if it matters)
nos
  • 223,662
  • 58
  • 417
  • 506
730
votes
47 answers

MetadataException: Unable to load the specified metadata resource

All of a sudden I keep getting a MetadataException on instantiating my generated ObjectContext class. The connection string in App.Config looks correct - hasn't changed since last it worked - and I've tried regenerating a new model (edmx-file) from…
J. Steen
  • 15,470
  • 15
  • 56
  • 63
445
votes
5 answers

Entity Framework VS LINQ to SQL VS ADO.NET with stored procedures?

How would you rate each of them in terms of: Performance Speed of development Neat, intuitive, maintainable code Flexibility Overall I like my SQL and so have always been a die-hard fan of ADO.NET and stored procedures but I recently had a play…
BritishDeveloper
  • 13,219
  • 9
  • 52
  • 62
439
votes
22 answers

Get connection string from App.config

var connection = ConnectionFactory.GetConnection( ConfigurationManager.ConnectionStrings["Test"] .ConnectionString, DataBaseProvider); And this is my App.config:
Moham ad Jafari
  • 4,399
  • 2
  • 15
  • 3
364
votes
17 answers

SET NOCOUNT ON usage

Inspired by this question where there are differing views on SET NOCOUNT... Should we use SET NOCOUNT ON for SQL Server? If not, why not? What it does Edit 6, on 22 Jul 2011 It suppresses the "xx rows affected" message after any DML. This is a…
gbn
  • 422,506
  • 82
  • 585
  • 676
321
votes
11 answers

Can you get the column names from a SqlDataReader?

After connecting to the database, can I get the name of all the columns that were returned in my SqlDataReader?
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
276
votes
10 answers

How to use DbContext.Database.SqlQuery(sql, params) with stored procedure? EF Code First CTP5

I have a stored procedure that has three parameters and I've been trying to use the following to return the results: context.Database.SqlQuery("mySpName", param1, param2, param3); At first I tried using SqlParameter objects as the…
electricsheep
  • 5,114
  • 9
  • 37
  • 41
276
votes
4 answers

Entity Framework and Connection Pooling

I've recently started to use the Entity Framework 4.0 in my .NET 4.0 application and am curious about a few things relating to pooling. Connection pooling as I know is managed by the ADO.NET data provider, in my case that of MS SQL server. Does…
Noldorin
  • 144,213
  • 56
  • 264
  • 302
268
votes
10 answers

Using MySQL with Entity Framework

Can't find anything relevant about Entity Framework/MySQL on Google so I'm hoping someone knows about it.
vintana
  • 2,893
  • 2
  • 18
  • 12
249
votes
14 answers

How do I create a DataTable, then add rows to it?

I've tried creating a DataTable and adding rows to it like this: DataTable dt = new DataTable(); dt.clear(); dt.Columns.Add("Name"); dt.Columns.Add("Marks"); How do I see the structure of DataTable? Now I want to add ravi for Name and 500 for…
Cute
  • 13,643
  • 36
  • 96
  • 112
222
votes
5 answers

What size do you use for varchar(MAX) in your parameter declaration?

I normally set my column size when creating a parameter in ADO.NET. But what size do I use if the column is of type VARCHAR(MAX)? cmd.Parameters.Add("@blah", SqlDbType.VarChar, ?????).Value = blah;
mrblah
  • 99,669
  • 140
  • 310
  • 420
220
votes
25 answers

Get the generated SQL statement from a SqlCommand object?

I have the following code: Using cmd As SqlCommand = Connection.CreateCommand cmd.CommandText = "UPDATE someTable SET Value = @Value" cmd.CommandText &= " WHERE Id = @Id" cmd.Parameters.AddWithValue("@Id", 1234) …
dummy
  • 4,256
  • 3
  • 25
  • 36
208
votes
3 answers

Under what circumstances is an SqlConnection automatically enlisted in an ambient TransactionScope Transaction?

What does it mean for an SqlConnection to be "enlisted" in a transaction? Does it simply mean that commands I execute on the connection will participate in the transaction? If so, under what circumstances is an SqlConnection automatically enlisted…
Triynko
  • 18,766
  • 21
  • 107
  • 173
198
votes
0 answers

SNIReadSyncOverAsync Performance issue

Recently I used dot Trace profiler to find the bottlenecks in my application. Suddenly, I have seen that in most of the places which are taking more time and more CPU usage to is SNINativeMethodWrapper.SNIReadSyncOverAsync() which is called by…
Gobi
  • 2,041
  • 1
  • 12
  • 10
187
votes
32 answers

A connection was successfully established with the server, but then an error occurred during the pre-login handshake

I am getting following error when i am trying to connect Production DB from Local Environment. I was able to connect Production DB before, but suddenly i am getting following error, any idea? A connection was successfully established with the…
Jordon Willis
  • 4,851
  • 7
  • 27
  • 34
1
2 3
99 100