Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. "data Source=?" to connect MS Access database at web server

"data Source=?" to connect MS Access database at web server

Scheduled Pinned Locked Moved ASP.NET
csharphelptutorialasp-netdatabase
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    multimedia9
    wrote on last edited by
    #1

    static string conn="provider=microsoft.jet.oledb.4.0;data Source="+ Server.MapPath("/data/db1.mdb"); OleDbConnection cn=new OleDbConnection(conn); please help me, where did i make wrong in the above instructions and please solve this. it show error that:'System.Web.UI.Page.Server' denotes a 'property' where a 'class' was expected www.mywebsite.com/data/db1.mdb how to access the db1.mdb file using Asp.NET using c# please help me i will be thank full to you. please answer me with above example multimedia9

    H 1 Reply Last reply
    0
    • M multimedia9

      static string conn="provider=microsoft.jet.oledb.4.0;data Source="+ Server.MapPath("/data/db1.mdb"); OleDbConnection cn=new OleDbConnection(conn); please help me, where did i make wrong in the above instructions and please solve this. it show error that:'System.Web.UI.Page.Server' denotes a 'property' where a 'class' was expected www.mywebsite.com/data/db1.mdb how to access the db1.mdb file using Asp.NET using c# please help me i will be thank full to you. please answer me with above example multimedia9

      H Offline
      H Offline
      Harini N K
      wrote on last edited by
      #2

      Hi Check this link Connection Strings[^]

      Harini

      M 1 Reply Last reply
      0
      • H Harini N K

        Hi Check this link Connection Strings[^]

        Harini

        M Offline
        M Offline
        multimedia9
        wrote on last edited by
        #3

        Hi frnd Thank u They hav given the general connection strings, these are used to connect to local host, but i need to connect to webserver. if you reply with appr answer i will be very happy, & please try to know the answer by asking ur colleagues. i will be thank ful to you if you consider this request. multimedia9

        H 1 Reply Last reply
        0
        • M multimedia9

          Hi frnd Thank u They hav given the general connection strings, these are used to connect to local host, but i need to connect to webserver. if you reply with appr answer i will be very happy, & please try to know the answer by asking ur colleagues. i will be thank ful to you if you consider this request. multimedia9

          H Offline
          H Offline
          Harini N K
          wrote on last edited by
          #4

          Hi 1. After deploying your web application in server and link will be like: http://10.57.89.15/TestWebApplication/page.aspx 2. The Virtual directory (i.e 'TestWebApplication' as in the above code) you created in server can be modified using Web.Config. Add a key and value to store virtual directory name. Use this key in your code-behind file. ConfigurationSettings.AppSettings 3. If your .mdb file is in sub-folder of your web app i.e., in App_Data. Then that file can be accessed using the foll. code string StrDataSource = Server.MapPath("\\TestWebApplication\\App_Data\\db1.mdb"); Hope you got it.

          Harini

          M 1 Reply Last reply
          0
          • H Harini N K

            Hi 1. After deploying your web application in server and link will be like: http://10.57.89.15/TestWebApplication/page.aspx 2. The Virtual directory (i.e 'TestWebApplication' as in the above code) you created in server can be modified using Web.Config. Add a key and value to store virtual directory name. Use this key in your code-behind file. ConfigurationSettings.AppSettings 3. If your .mdb file is in sub-folder of your web app i.e., in App_Data. Then that file can be accessed using the foll. code string StrDataSource = Server.MapPath("\\TestWebApplication\\App_Data\\db1.mdb"); Hope you got it.

            Harini

            M Offline
            M Offline
            multimedia9
            wrote on last edited by
            #5

            hi thank u :) string StrDataSource = Server.MapPath("\\TestWebApplication\\App_Data\\db1.mdb"); this instruction gives an error that " 'System.Web.UI.Page.Server' denotes a 'property' where a 'class' was expected ". Please solve this problem. thank u

            H 1 Reply Last reply
            0
            • M multimedia9

              hi thank u :) string StrDataSource = Server.MapPath("\\TestWebApplication\\App_Data\\db1.mdb"); this instruction gives an error that " 'System.Web.UI.Page.Server' denotes a 'property' where a 'class' was expected ". Please solve this problem. thank u

              H Offline
              H Offline
              Harini N K
              wrote on last edited by
              #6

              Hi It was working fine for me when I give Server.MapPath. Try change Server.MapPath to HttpContext.Current.Server.MapPath

              Harini

              M 1 Reply Last reply
              0
              • H Harini N K

                Hi It was working fine for me when I give Server.MapPath. Try change Server.MapPath to HttpContext.Current.Server.MapPath

                Harini

                M Offline
                M Offline
                multimedia9
                wrote on last edited by
                #7

                ya its working thank u very very much for avoiding such error, by using HTTP.........:) could u plz help me in another prob My website contains 1)let me take my website ftp address 10.29.398.456 & http address www.mydomain.com 2)under which /db /logs /wwwroot folders are there 3)under /wwwroot /data /mail and some other folders 4)under /data /db1.mdb is there by using above example please write configurationSettings & connection string bcoz even though it not showing error it shows error at runtime thank u very much, I hope u will reply for this. multimedia9

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups