What is the difference between the SQL Connection and OLEDB Connection? Is that OLEDB is common to all (also SQL Server)? To which are all Servers, OLEDB is using?
The advantage of using OleDbConnection is flexibility. You can change your database (for instance, move to Oracle)and not have to change your code.
If you using SQLServer as backend then use SQLConnection for better performance.
check with this link http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/fadb2742-d75a-49fb-a839-b2d4a9183998/
OleDbConnection : You can connect to any database, which you have provide for that.
Tip: use Universal Data Link File
SqlConnection is designed to access SQL Server, while OleDbConnection is designed to access any database.
Related
can we access the msacces table using a windows service which is created in vb.net. Thanks!
Yes.
You can use an OleDbConnection with this connection string (or this one for 2007 / 2010).
You can then execute arbitrary SQL statements on the connection.
I use vb.net and windows form and sqlserver
I added Data Source(Microsoft SQL Server (SqlClient)) to my project. and now I need to change it to ODBC Data Source .
How Can I do That?
thanks
See these resources - you cannot simply change your SqlClient/SqlCOnnection - you need to use OdbcConnection instead:
Connecting to an ODBC Data Source Using ADO.NET
ADO.NET ODBC connection in VB.NET
ODBC is a technology several generations older than ADO.NET/SqlClient - why do you want to "downgrade" back into the dark ages?? What are you trying to achieve that you cannot do using SqlClient?? If you really must connect to a multitude of different datasources, I would strongly recommend using / investigating OleDB instead of ODBC. ODBC is really quite old, and e.g. doesn't have any 64-bit capable drivers.... OleDB does!
See the Wikipedia article on OleDB, and view impressive lists of OleDB data providers here and here for some insights.
I have an SQL database and want to connect to it using VBA in order to support some legacy functionality. I'm using an ADODB connection and need to know what my database DSN is. How can I find this?
I'm using SQL Server 2008, thanks! :D
A DSN (data source name) is an indirect way of referring to the database. You have to create them manually (or semi-automatically using a wizard of some kind). Go to ControlPanel->AdministrativeTools->DataSources (ODBC) to see if one has already been defined for the database to which you want to connect.
But I think you might mean "connection string", not "DSN". There are many, many ways to tell ADODB how to find and connect to your database (DSNs are just one of those), but you always need a connection string.
I have often turned to ConnectionStrings.com to help me through the maze of similar-but-not-identical options.
There may not be a DSN. DSNs are not created automatically.
I'm not sure you really mean DSN, as a DSN is an ODBC concept. Still, look in Administrative Tools->Data Sources (ODBC).
can anybody tell me what are the advantages of oledb connection over sql connection
SqlConnection only works with SQL Server, but OleDbConnection works with any OLEDB data source.
In practice, no advantage unless the database you use does not have good ADO.NET support.
For example, if you use SQL Server or Oracle, you should use SqlConnection or OracleConnection. If you use OleDbConnection here, you may lose certain features or performance.
As many database vendors still fail to provide good ADO.NET support, OleDbConnection is there for you to connect to them.
Personally I don't know many enterprise products switch from a DB vendor to another in its lifecycle, so I always go straight to SqlConnection or OracleConnection.
I want to create a SQL connection using DSN. Then I want to generate the DAL using Subsonic. Please can you give me some pointers on what to do?
You don't need a DSN in these days (I assume you want to abstract the connection) - you can do that with SubSonic 3 by specifying the provider right in the connection string. If you want to switch providers, just change the "providerName" attribute of the connectionString.
I'm wondering if this is for legacy issues but a DSN is entirely in your control, it seems - and I think there's a better way.