Solutions to access database self-starting difficulties
Source: Internet
Author: User
Problem Analysis for a long time,
After troubleshooting, the problem lies in the database startup path, which can be written when you connect to the database.
Getmodulefilename (null, path, 255); // get the self-started ProgramComplete path;
Cstring STR;
Str. Format ("% s", PATH );
Int place;
Place = Str. reversefind ('\'); // obtain the position of the last;
Cstring db_name;
Db_name = Str. Left (place + 1) + "qijian. mdb"; // integrate the full path of the Access Database
Cstring connect; // The first connection parameter.
Connect = "provider = Microsoft. Jet. oledb.4.0; Data Source =" + db_name + ";";
HR = theapp. m_pconnection-> openconnect. getbuffer (connect. getlength (), "", "", admodeunknown); // input and connect Parameters
Remaining CodeYou do not need to change it more.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.