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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. What's wrong with database? Can anybody help? [modified]

What's wrong with database? Can anybody help? [modified]

Scheduled Pinned Locked Moved Managed C++/CLI
helpdatabasequestion
4 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.
  • B Offline
    B Offline
    Badboy22TR
    wrote on last edited by
    #1

    I use InstallShield for my project. My project has database, i put it to Install Shield's "Application Folder", although i changed the connection string "c:\Documents and Setting\bla bla bla\xxx.mdb" to "xxx.mdb" (software runs my computer well with this string), i don't run it correctly on an another computer after installed it. It crashed when program tried to reach database. An error generated like this "c:\Documents and Settings\........\xxx.mdb couldn't be found". I don't understand :( Why it didn't work although i changed the connection string? Can anybody hel me please ? -- modified at 5:00 Saturday 31st March, 2007

    S 1 Reply Last reply
    0
    • B Badboy22TR

      I use InstallShield for my project. My project has database, i put it to Install Shield's "Application Folder", although i changed the connection string "c:\Documents and Setting\bla bla bla\xxx.mdb" to "xxx.mdb" (software runs my computer well with this string), i don't run it correctly on an another computer after installed it. It crashed when program tried to reach database. An error generated like this "c:\Documents and Settings\........\xxx.mdb couldn't be found". I don't understand :( Why it didn't work although i changed the connection string? Can anybody hel me please ? -- modified at 5:00 Saturday 31st March, 2007

      S Offline
      S Offline
      Sahir Shah
      wrote on last edited by
      #2

      Please see http://msdn2.microsoft.com/en-us/library/ms254499.aspx[^] Alternately you can also consider placing the .mdb file in the same folder as the application and use Application.StartupPath in your connection string.

      B 1 Reply Last reply
      0
      • S Sahir Shah

        Please see http://msdn2.microsoft.com/en-us/library/ms254499.aspx[^] Alternately you can also consider placing the .mdb file in the same folder as the application and use Application.StartupPath in your connection string.

        B Offline
        B Offline
        Badboy22TR
        wrote on last edited by
        #3

        Thanks for your reply. I tried to do your suggests. I find that the problem is dataset. However i changed the connectionstring in the forms, connectionstring in dataset remains. What i can do for it? Can i write a function to dataset.h? like " String^ path = Application::StartupPath; this->oleDbConnection1->ConnectionString = L"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\""+path+"\\xxx.mdb\""; "

        B 1 Reply Last reply
        0
        • B Badboy22TR

          Thanks for your reply. I tried to do your suggests. I find that the problem is dataset. However i changed the connectionstring in the forms, connectionstring in dataset remains. What i can do for it? Can i write a function to dataset.h? like " String^ path = Application::StartupPath; this->oleDbConnection1->ConnectionString = L"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\""+path+"\\xxx.mdb\""; "

          B Offline
          B Offline
          Badboy22TR
          wrote on last edited by
          #4

          Ok..Finally i solved the problem. If anyone has the same problem, just replace the whole path (eg. "C:\Documents and Settings\XYZ\My Documents\Microsoft Visual Studio 2005\Projects\Release\") ConnectionString in Dataset Header with |DataDirectory| this->_connection->ConnectionString = L"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"|DataDirectory|\\xxx.mdb\""; and if you have connection in form, write a simple code in Form_Load event, replace ConnectionString with something like : private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { String^ path = Application::StartupPath; this->oleDbConnection1->ConnectionString = L"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\""+path+"\\hasta.mdb\""; }

          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