access file path question

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

    access file path question

    I usually use SQL Server, but have occasionally had to use Access. This is
    such an occasion. My research, mainly at aspfaq.com, has been that you need
    to put the file path in your connection string, like this (watch out for the
    wrap):

    strConnection = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
    Source=c:\mydir ectoryname\dbna me.mdb;User Id=xxxxx;Passwo rd=xxxxxxx;"


    Well, the host of this new site I am working on is asking me if a relative
    path will work. I don't think it will, but thought I should ask.

    And please, I know that Access is not a good choice, but it needs to be this
    way in this case.


  • Peter Foti

    #2
    Re: access file path question

    "middletree " <middletree@hto mail.com> wrote in message
    news:ecDM$y5BEH A.1220@TK2MSFTN GP10.phx.gbl...[color=blue]
    > I usually use SQL Server, but have occasionally had to use Access. This is
    > such an occasion. My research, mainly at aspfaq.com, has been that you[/color]
    need[color=blue]
    > to put the file path in your connection string, like this (watch out for[/color]
    the[color=blue]
    > wrap):
    >
    > strConnection = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
    > Source=c:\mydir ectoryname\dbna me.mdb;User Id=xxxxx;Passwo rd=xxxxxxx;"
    >
    >
    > Well, the host of this new site I am working on is asking me if a relative
    > path will work. I don't think it will, but thought I should ask.[/color]

    I believe it needs to be a path like the one you listed, but you could also
    use the MapPath function to get the full path to the file.


    Hope this helps.
    Peter Foti


    Comment

    • Peter Foti

      #3
      Re: access file path question

      "Peter Foti" <peter@Idontwan tnostinkingemai lfromyou.com> wrote in message
      news:1051g6qthj vtpf1@corp.supe rnews.com...[color=blue]
      > "middletree " <middletree@hto mail.com> wrote in message
      > news:ecDM$y5BEH A.1220@TK2MSFTN GP10.phx.gbl...[color=green]
      > > I usually use SQL Server, but have occasionally had to use Access. This[/color][/color]
      is[color=blue][color=green]
      > > such an occasion. My research, mainly at aspfaq.com, has been that you[/color]
      > need[color=green]
      > > to put the file path in your connection string, like this (watch out for[/color]
      > the[color=green]
      > > wrap):
      > >
      > > strConnection = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
      > > Source=c:\mydir ectoryname\dbna me.mdb;User Id=xxxxx;Passwo rd=xxxxxxx;"
      > >
      > >
      > > Well, the host of this new site I am working on is asking me if a[/color][/color]
      relative[color=blue][color=green]
      > > path will work. I don't think it will, but thought I should ask.[/color]
      >
      > I believe it needs to be a path like the one you listed, but you could[/color]
      also[color=blue]
      > use the MapPath function to get the full path to the file.[/color]

      Meant to include this link:


      Regards,
      Peter Foti


      Comment

      • Imran Salahuddin Khan

        #4
        Re: access file path question

        why don't you use server.mappath? ??? like below

        strConnection = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
        Source="&server .mappath("relat ivepath")&";Use r
        Id=xxxxx;Passwo rd=xxxxxxx;"

        relative path may be any relative path of your access db...

        !mran Khan

        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        • Jeff Cochran

          #5
          Re: access file path question

          On Thu, 11 Mar 2004 13:12:05 -0600, "middletree "
          <middletree@hto mail.com> wrote:
          [color=blue]
          >I usually use SQL Server, but have occasionally had to use Access. This is
          >such an occasion. My research, mainly at aspfaq.com, has been that you need
          >to put the file path in your connection string, like this (watch out for the
          >wrap):
          >
          >strConnectio n = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
          >Source=c:\mydi rectoryname\dbn ame.mdb;User Id=xxxxx;Passwo rd=xxxxxxx;"
          >
          >
          >Well, the host of this new site I am working on is asking me if a relative
          >path will work. I don't think it will, but thought I should ask.[/color]

          Relative path works, placing the MDB in the same folder (no path)
          works and Server.MapPath works. Depending on what your ISP allows and
          where the database is located.
          [color=blue]
          >And please, I know that Access is not a good choice, but it needs to be this
          >way in this case.[/color]

          Access is fine, provided you understand and can live with its
          limitations.

          Jeff

          Comment

          • middletree

            #6
            Re: access file path question

            can't seem to make it work.

            Here's my entire code for this include file, and the only thing I changed
            here is the ID and password:

            strConnection =
            "Provider=Micro soft.Jet.OLEDB. 4.0;DataSource= "&server.mappat h("\")"&shape.m d
            b;User Id=x;Password=x ;"

            filePath = Server.MapPath( "shape.mdb" )

            I did this because the Access db is in the same folder as the page which
            calls it (not the include file, but the page which calls the include)

            The error I get now is:
            Expected end of statement

            /gracearlingtonc om/shape/includes/shapedbinc.asp, line 5

            strConnection =
            "Provider=Micro soft.Jet.OLEDB. 4.0;DataSource= "&server.mappat h("\")"&shape.m d
            b;User Id=admin;Passwo rd=;"
            ----------------------------------------------------------------------------
            ------^In case the wrap is messing things up for you, the arrow is pointing
            to the quote mark right after the closing parenthesis.


            "Imran Salahuddin Khan" <itisimrankhan@ hotmail.com> wrote in message
            news:%23ii0$aCC EHA.3184@TK2MSF TNGP09.phx.gbl. ..[color=blue]
            > why don't you use server.mappath? ??? like below
            >
            > strConnection = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
            > Source="&server .mappath("relat ivepath")&";Use r
            > Id=xxxxx;Passwo rd=xxxxxxx;"
            >
            > relative path may be any relative path of your access db...
            >
            > !mran Khan
            >
            > *** Sent via Developersdex http://www.developersdex.com ***
            > Don't just participate in USENET...get rewarded for it![/color]


            Comment

            • Peter Foti

              #7
              Re: access file path question

              "middletree " <middletree@hto mail.com> wrote in message
              news:uZiMaEECEH A.2164@TK2MSFTN GP10.phx.gbl...[color=blue]
              > can't seem to make it work.
              >
              > Here's my entire code for this include file, and the only thing I changed
              > here is the ID and password:
              >
              > strConnection =
              >[/color]
              "Provider=Micro soft.Jet.OLEDB. 4.0;DataSource= "&server.mappat h("\")"&shape.m d[color=blue]
              > b;User Id=x;Password=x ;"[/color]

              Try this:
              strConnection =
              "Provider=Micro soft.Jet.OLEDB. 4.0;DataSource= "&server.mappat h("\shape.md
              b")&";User Id=x;Password=x ;"


              Regards,
              Peter Foti


              Comment

              • middletree

                #8
                Re: access file path question

                Looks like it got past that problem. Now, I have to go research what this
                means:

                Microsoft JET Database Engine error '80004005'
                Could not find installable ISAM.

                /gracearlingtonc om/shape/list.asp, line 37



                thanks




                "Peter Foti" <peter@Idontwan tnostinkingemai lfromyou.com> wrote in message
                news:1053kvcib8 67kc5@corp.supe rnews.com...[color=blue]
                > Try this:
                > strConnection =
                > "Provider=Micro soft.Jet.OLEDB. 4.0;DataSource= "&server.mappat h("\shape.md
                > b")&";User Id=x;Password=x ;"[/color]


                Comment

                Working...