Click here to Skip to main content
15,900,973 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello, i try to connect access using MFC,
here is the sample code
CString str;
str=_T("Provider=Microsoft.Jet.OLEDB.4.0;""Data Source=C:\\Users\\User\\Documents\\DataBase.mdb;");

there is an error,

CSS
error C2308: concatenating mismatched strings
1>          Concatenating wide "Provider=Microsoft.Jet.OLEDB.4.0;" with narrow "Data Source=C:\Users\User\Documents\DataBase.mdb;"


can anyone tell me what is the prob?? thanks..
Posted

1 solution

replace the str with:
C++
str=_T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\User\\Documents\\DataBase.mdb;");

(basically, remove "" from the middle of the string)
 
Share this answer
 
Comments
(unkownOfMe) 9-Oct-12 1:52am    
thx! :) do u mind to teach me how to make open the access file??
other then that i will try to solve it by my own.
need some sample :)
thx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900