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

What are the several execute methods of ado.net?

504


Define atomicity?

581


What is the default Timeout for SqlCommand.CommandTimeout property?

510


Explain the overview of ado.net architecture?

521


Which architecture does Datasets follow?

586






How can we add relation between tables in a dataset?

547


How will you fill the gridview by using datatable object at runtime?

550


What is csdl entity framework?

555


Explain the various objects in dataset.

528


How to check if a datareader is closed or opened? IsClosed()

586


What is namespace in ado.net?

500


What are different layers of ADO.Net?

590


What is ado in agriculture?

515


What is typed dataset ?

678


What is meant by executenonquery?

529