database connection
-
Hello everyone, I am having a crazy problem, and cannot find anything on the Internet as to why this is happening. I have a project folder, in which I have a Database folder. +Project (Folder) Project files (forms) +Database (Folder) Database files +XML (Folder) When I make an OLEdbConnection from a form in my project files folder, the absolute path looks like this D:\Documents and Settings\j\Desktop\DEVELOPMENT\GradID\Database\GradIdentDB.mdb when I test the connection, it works. however, I want it to be a relative link so I set it up like this since I am in the project folder and want to go down into the database folder. .\Database\GradIdentDB.mdb However, when I test the connection I get this error. D:\Documents and Settings\j\Desktop\DEVELOPMENT\GradID\Database\Database\GradIdentDB.mdb Notice the two "Database" in a row, it's as if my project is in the Database folder. Understand? The relative link that works is .\GradIdentDB.mdb Again, it looks like Visual Studio thinks my form is in the Databse folder, but it isn't, it is in the Project Folder. Someone suggested making sure my output path as /bin, mine says bin/, and when I tried to change it to /bin, VS.NET turned it back to bin/ Anyone know how to fix this? Also, another similar problem creeps up when I import names from an Excel sheet, say the Excel sheet is in the C:\ root, I'll get an error that says my path to my .mdb is invalid. In other words it stops looking here D:\Documents and Settings\j\Desktop\DEVELOPMENT\GradID\Database\GradIdentDB.mdb and starts looking here C:\Database\GradIdentDB.mdb if the Excel sheet is in the D:\ root then it start looking here for my .MDB. D:\Database\GradIdentDB.mdb this makes no sense at all. Any help would be great. thanks, Jason
-
Hello everyone, I am having a crazy problem, and cannot find anything on the Internet as to why this is happening. I have a project folder, in which I have a Database folder. +Project (Folder) Project files (forms) +Database (Folder) Database files +XML (Folder) When I make an OLEdbConnection from a form in my project files folder, the absolute path looks like this D:\Documents and Settings\j\Desktop\DEVELOPMENT\GradID\Database\GradIdentDB.mdb when I test the connection, it works. however, I want it to be a relative link so I set it up like this since I am in the project folder and want to go down into the database folder. .\Database\GradIdentDB.mdb However, when I test the connection I get this error. D:\Documents and Settings\j\Desktop\DEVELOPMENT\GradID\Database\Database\GradIdentDB.mdb Notice the two "Database" in a row, it's as if my project is in the Database folder. Understand? The relative link that works is .\GradIdentDB.mdb Again, it looks like Visual Studio thinks my form is in the Databse folder, but it isn't, it is in the Project Folder. Someone suggested making sure my output path as /bin, mine says bin/, and when I tried to change it to /bin, VS.NET turned it back to bin/ Anyone know how to fix this? Also, another similar problem creeps up when I import names from an Excel sheet, say the Excel sheet is in the C:\ root, I'll get an error that says my path to my .mdb is invalid. In other words it stops looking here D:\Documents and Settings\j\Desktop\DEVELOPMENT\GradID\Database\GradIdentDB.mdb and starts looking here C:\Database\GradIdentDB.mdb if the Excel sheet is in the D:\ root then it start looking here for my .MDB. D:\Database\GradIdentDB.mdb this makes no sense at all. Any help would be great. thanks, Jason
You are going to need to modify your connection string. This is done most easily by modifying the " Windows Form Designer generated code " - you know, the stuff you're not supposed to change. 1. Search for "ConnectionString" in the hidden text. 2. In that mighty long string, find "Data Source=". This will give you the full absolute path. I think you can just change out the full path to your relative one. Otherwise you can set the path to 'Application.StartupPath & "\Database\GradientDB.mdb"' To not know is bad. To not wish to know is worse.