Library tutorials & articles
Creating a database connection
- Introduction
- The Connection String
- Opening and Closing
Opening and Closing
After declaring your connection and setting the Connection String, the next
thing to do is to open the connection, and also learn how to close it! ;)
Before you can perform any data reading or any forms of manipulation, you will
have to open the connection first. Every connection object has a method we call
Open as well as Close.
SQL:
VB: SqlConn.Open()
C#: SqlConn.Open();
OLE:
VB: OleConn.Open()
C#: OleConn.Open();
Wow pretty... simple isn't it? The Close() Method is the same as the Open.
Just call it and It will close the corresponding conneciton object....
like in... OleConn.Close()
I have created a Sample application (created in VB) for you to skim over; just click 'Download Source Code' above. If there are any errors please inform me!! :) Have fun and I hope this 'tutorial' helps ya ;)
Related articles
Related discussion
-
Binary Studio | software development outsourcing Ukraine
by shane124 (4 replies)
-
Research topic in software
by reachsangeethamathew (0 replies)
-
career improvement advice
by hnasr82 (0 replies)
-
Advice on studying and preparing for interviews
by caryatid (0 replies)
-
Chart insertation in a windows form...
by pdhanik (1 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
-
Nov
18
15 Minutes of Fame
Dresher, United States
This is a yearly tradition. We select 10 of the favorite speakers from monthly meetings, code camps, and hands on labs. Each one does a 15 minute talk on their favorite .NET technology. This is our 10th anniversary so we plan a gala event with special prizes and refreshments.
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.