Library tutorials & articles
Creating a database connection
- Introduction
- The Connection String
- Opening and Closing
The Connection String
By far one of the most important properties of the Connection object would
have to be the Connection String! It specifies where to connect, who is
connectiong, what database to look at, etc. The connection string is the
backbone of the Connection object. Ole and SQL both use Connection Strings.
The connection string is formatted like this:
"keyword=value;keyword=value;keyword=value;keyword=value"
You get the idea.
Some Keywords:
SQL:
database - what database to look at
server - the server that you are connecting to
trusted_connection - whether or not the machine is trusted
(don't need uid/pw)
uid - username
pwd - password
OLE:
data source - Where the file is...
provider - the Data provider
Examples:
SQL: "server=tonydev;database=northwind;uid=tony;pwd=hrmmm"
"server=tonydev;database=northwind;trusted_connection=yes"
OLE: "Provider=Microsoft.Jet.OLEDB.4.0; Data source=C:\tony.mdb"
Both the SQL and OLE Connection object have a property called 'ConnectionString',
so the first thing you do after declaring the objects is set its connection
string.
Related articles
Related discussion
-
VS.NET/sql server installation problem
by daspeac (4 replies)
-
Unable to access AxInterop.AcoPdflib.dll on 64 bit OS
by Shaila14041981 (0 replies)
-
connect to .dbf files
by daspeac (5 replies)
-
Binary Studio | software development outsourcing Ukraine
by shane124 (4 replies)
-
Research topic in software
by reachsangeethamathew (0 replies)
Related podcasts
-
More jQuery in ASP.NET
In this episode Chris Brandsma, Rick Strahl, Dave Ward, Bertrand Le Roy, and Scott Koon conclude their discussion of Microsoft's jQuery in ASP.NET announcement1.This episode of the Alt.NET Podcast is brought to you by LLBLGen Pro, the most mature O/R mapper and code generator out there.Are ...
Events coming up
-
Dec
9
GL.net Group Meeting - December 2009
Gloucester, United Kingdom
The beginning of this year holiday season will belong to mocks. Ronnie and Stephen will take us for a tour around exciting world of unit testing.
Thanks for taking the time to post this great little sample, complete with a working app and source code. It was very helpful to me. May you get laid constantly in college, graduate with a nice CS degree, and land a job at a hot game developer outfit where you get paid to have fun building stuff while making a ton of money.
here is my codes..please tell my the error and what else do i need to put..
Try
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\App1\Your_Database_Name.mdb; Jet OLEDB:Database Password=Your_Password"
Hi..
I'm trying to connect to an access database that is protected by password. but, it's always says "the database is being opened exclusively by another program" even I don't open other application. Please help me to solve this problem
string qryStr;
OleDbConnection dbConn;
connStr = "Provider=Microsoft.Jet.OLEDB.4.0; " +
"Data Source=G:\\Backup\\Kashif\\xyzDB.mdb";
qryStr = "select content,websiteID from content";
dbConn = new OleDbConnection(connStr);
Amir
Plz reply me when i ma writing in c# using System.Data.Ado for the database connection with m.s acess then it is giving errror the type name space ado does not exist in in the class system.Data.ADO
what is reason
plz answer me
I keep getting an error when I try and create a new data connection. This is the error I'm getting.
Unable to connect to database.
It is only possible to connect to SQL Server Desktop Engine databases and Microsoft Access with this version of Visual Studio.
I can connect to Access without any problems. Is there anyway around this?
I'm using VB .net Standard with SQL Server 2000.
Thanks for any help.
Sir,
I am presently engaged in doing networking project in VB.NET and MSAcces.
I would like to know the connection string
(Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.......) for connecting to a database in another machine(given its machine name) in a network while sitting in my own machine(also in the same network). I would be grateful if you help. Expecting your early reply,
Thank you
Renjini S
Please mail me at
srenjini@sify.com
It´s ok. works good
This thread is for discussions of Creating a database connection.