Dear Sir
My question is in wed application how can we mention connection string without writing the drive in which database is present.I don't know how i
I use web config file to write connection string.Please help.

Partial Class supports
    Inherits System.Web.UI.Page
    Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\progr2\App_Data\Database\health.mdb;Persist Security Info=False")
Public Sub opencn()
        If con.State = Data.ConnectionState.Closed Then
            con.Open()
        End If
end sub
end class

|DataDirectory| is a substitution string that indicates the path to the database.

Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Database\health.mdb;Persist Security Info=False")
Public Sub opencn()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.