
September 5th, 2003, 08:00 AM
|
|
Contributing User
|
|
Join Date: Aug 2003
Posts: 64
Time spent in forums: 24 m 30 sec
Reputation Power: 10
|
|
Well I found a way (had to change the security options for this folder)but now I have a new problem. I use this program to connect to an Access-Database. The database is in the same folder as the exe.
Code:
String* Databasename="mydatabase.mdb";
GetModuleFileName (NULL, szBuffer, MAX_PATH);
GetFullPathName (szBuffer, sizeof (szBuffer), szpath, &pFilename);
szpath[pFilename-szpath]= '\0';
String* path2=Convert::ToString(szpath);
String* myDatabase=myDatabase->Concat(path2,Databasename);
OleDbConnection* DBCONNECTION=new OleDbConnection();
String* Connect=S"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=XXX;";
Connect=Connect->Replace("XXX",myDatabase);
DBCONNECTION->ConnectionString=Connect;
As you can see I let the program find the path to the database and use it to connect to it!
But when I start the program through network my program adds a \ to the beginning of the path
(so this
\\44-test\Customer\mydatabase.mdb
is changed into this
\\\44-test\Customer\mydatabase.mdb
)
Why does it adds this \? How can I prevent it from adding this \?
|