How would u connect to database using .NET?

Answer Posted / rathish

go to project->add reference->adodb

DECLERATION

Dim con As ADODB.Connection
Dim cmd As ADODB.Command
Dim str, cnstr, sql As String
Dim cn As OleDb.OleDbConnection


FORM LOAD

Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
con = New ADODB.Connection
con.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\new folder\employee.mdb")
End Sub

in the source you have to give the path of ur file name..

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to pass multiple tables in datasets simultaneously?

569


how to create a quiz software using 4 options to answer and how to check with answers in the database and award marks....

3710


Define bubbled event?

513


how can implement dropdownlist in particular of dataset when try to update?

2306


What is the difference between sqlcommand and sqldataadapter?

497






What is sqlconnection and sqlcommand?

517


What is ole data type?

503


What is isolation?

565


What is ole in vb?

508


What is difference between executenonquery and executequery?

468


How can we add/remove row's in "datatable" object of "dataset"?

539


What is dbcontext and dbset in entity framework?

484


What are the major challenges in accessing data from a database?

529


What are the Features of a dataset

666


Explain the basic use of "dataview" and explain its methods.

527