data source

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • freddy

    data source

    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=Micro soft.Jet.OLEDB. 4.0;Data
    Source=E:\\\\Fr eddy\\Projects\ \vb.net\\Projec t Track It\\bin\\Projec t.mdb";
  • Dmytro Lapshyn [MVP]

    #2
    Re: data source

    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=Micros oft.Jet.OLEDB.4 .0;DataSource={ 0}\\bin\\Projec t.mdb",
    Server.MapPath( "/MyWebApp");

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


    "freddy" <freddy@discuss ions.microsoft. com> wrote in message
    news:C7492021-E9B3-42C7-929E-069D20C990D6@mi crosoft.com...[color=blue]
    >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=Micro soft.Jet.OLEDB. 4.0;Data
    > Source=E:\\\\Fr eddy\\Projects\ \vb.net\\Projec t Track
    > It\\bin\\Projec t.mdb";[/color]

    Comment

    • freddy

      #3
      Re: data source

      this is for a winform

      "Dmytro Lapshyn [MVP]" wrote:
      [color=blue]
      > 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=Micros oft.Jet.OLEDB.4 .0;DataSource={ 0}\\bin\\Projec t.mdb",
      > Server.MapPath( "/MyWebApp");
      >
      > --
      > Sincerely,
      > Dmytro Lapshyn [Visual Developer - Visual C# MVP]
      >
      >
      > "freddy" <freddy@discuss ions.microsoft. com> wrote in message
      > news:C7492021-E9B3-42C7-929E-069D20C990D6@mi crosoft.com...[color=green]
      > >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=Micro soft.Jet.OLEDB. 4.0;Data
      > > Source=E:\\\\Fr eddy\\Projects\ \vb.net\\Projec t Track
      > > It\\bin\\Projec t.mdb";[/color]
      >
      >[/color]

      Comment

      • Dmytro Lapshyn [MVP]

        #4
        Re: data source

        Then, use Application.Sta rtupPath instead of Server.MapPath.

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


        "freddy" <freddy@discuss ions.microsoft. com> wrote in message
        news:697DE242-C049-4B2B-B890-FD8DF0936DC8@mi crosoft.com...[color=blue]
        > this is for a winform
        >
        > "Dmytro Lapshyn [MVP]" wrote:
        >[color=green]
        >> 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=Micros oft.Jet.OLEDB.4 .0;DataSource={ 0}\\bin\\Projec t.mdb",
        >> Server.MapPath( "/MyWebApp");
        >>
        >> --
        >> Sincerely,
        >> Dmytro Lapshyn [Visual Developer - Visual C# MVP]
        >>
        >>
        >> "freddy" <freddy@discuss ions.microsoft. com> wrote in message
        >> news:C7492021-E9B3-42C7-929E-069D20C990D6@mi crosoft.com...[color=darkred]
        >> >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=Micro soft.Jet.OLEDB. 4.0;Data
        >> > Source=E:\\\\Fr eddy\\Projects\ \vb.net\\Projec t Track
        >> > It\\bin\\Projec t.mdb";[/color]
        >>
        >>[/color][/color]

        Comment

        Working...