Why I can't Open the mdb file correctly?
-
I use CDaodatabase to open the mdb file, I use the code follow: try { m_db.Open(m_Source,FALSE,FALSE,_T("")); } catch(CDaoException* e) { e->Delete(); return false; } return true; but every time it throw a error code
-
I use CDaodatabase to open the mdb file, I use the code follow: try { m_db.Open(m_Source,FALSE,FALSE,_T("")); } catch(CDaoException* e) { e->Delete(); return false; } return true; but every time it throw a error code
Since you haven't posted enough code we can only guess. If you have kept the mdb open in Access , then Access has exclusive access. Close Access before running your code. That might be the problem. Nish Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic -
I use CDaodatabase to open the mdb file, I use the code follow: try { m_db.Open(m_Source,FALSE,FALSE,_T("")); } catch(CDaoException* e) { e->Delete(); return false; } return true; but every time it throw a error code
What is your Access database version ? If you used Access 2000, then you must use AfxGetModuleState for solve it ! See MSDN ! My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie
-
Since you haven't posted enough code we can only guess. If you have kept the mdb open in Access , then Access has exclusive access. Close Access before running your code. That might be the problem. Nish Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran IvanisevicThat could be it, although, to my knowledge, Access 97 doesn't demand exclusive access to the .mbd it has open. At least, my application can read the database without any problems. Quite handy since i can modify the database in Access, and have my app redraw the results by invalidating the view. :) Simon Hey, it looks like you're writing a letter! Sonork ID 100.10024
-
What is your Access database version ? If you used Access 2000, then you must use AfxGetModuleState for solve it ! See MSDN ! My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie
Sorry ,I can't find the AfxGetModuleState function in MSDN Can you show me how to use it? thank you
-
Sorry ,I can't find the AfxGetModuleState function in MSDN Can you show me how to use it? thank you
One of member variables in AfxGetModuleState is about Database version, set it to 0x601 ... don't ask me WHY ? (it is because you are using Access 2000) Then you can use Open function ! Bye, i'm now busy, sorry ! My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie
-
That could be it, although, to my knowledge, Access 97 doesn't demand exclusive access to the .mbd it has open. At least, my application can read the database without any problems. Quite handy since i can modify the database in Access, and have my app redraw the results by invalidating the view. :) Simon Hey, it looks like you're writing a letter! Sonork ID 100.10024
It works better (sharing wise) if you have your tables seperate from the code/views etc. Its also handy to have your queries external. Access's own user login bit has never seemed to quite get the hang of sharing. With a sort of random selection of locking techniques, one record or whole table. This all seems to be ok once your tables are seperated. Another point, which will no doubt cause a scrap amongst us all, is that I tend towards a non Access data type. DBase IV is a favourite, since it can be made accessible from many different language/office apps and you have a wide range of ODBC drivers that your own code can use. (I'll wait behind the bike sheds for the first up) We do it for the joy of seeing the users struggle.