data source

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I went to save an access db in the bin folder so I do not have to hard code
it like this:
string sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\\\\Freddy\\Projects\\vb.net\\Project Track It\\bin\\Project.mdb";
 
Hi Freddy,

I assume it is an ASP .NET app, where you can probably use Server.MapPath to
obtain the physical path of the virtual folder where your ASP .NET
application resides:

string sConnString =
string.Format("Provider=Microsoft.Jet.OLEDB.4.0;DataSource={0}\\bin\\Project.mdb",
Server.MapPath("/MyWebApp");
 
this is for a winform

Dmytro Lapshyn said:
Hi Freddy,

I assume it is an ASP .NET app, where you can probably use Server.MapPath to
obtain the physical path of the virtual folder where your ASP .NET
application resides:

string sConnString =
string.Format("Provider=Microsoft.Jet.OLEDB.4.0;DataSource={0}\\bin\\Project.mdb",
Server.MapPath("/MyWebApp");

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


freddy said:
I went to save an access db in the bin folder so I do not have to hard code
it like this:
string sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\\\\Freddy\\Projects\\vb.net\\Project Track
It\\bin\\Project.mdb";
 
Then, use Application.StartupPath instead of Server.MapPath.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


freddy said:
this is for a winform

Dmytro Lapshyn said:
Hi Freddy,

I assume it is an ASP .NET app, where you can probably use Server.MapPath
to
obtain the physical path of the virtual folder where your ASP .NET
application resides:

string sConnString =
string.Format("Provider=Microsoft.Jet.OLEDB.4.0;DataSource={0}\\bin\\Project.mdb",
Server.MapPath("/MyWebApp");

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


freddy said:
I went to save an access db in the bin folder so I do not have to hard
code
it like this:
string sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\\\\Freddy\\Projects\\vb.net\\Project Track
It\\bin\\Project.mdb";
 
Back
Top