Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys Can anyone help me with this warning ,actually I am working on MFC dialog application and where i am getting some data from the database using ODBC connection and
I am performing a query.
str.Format(_T("XYZ=%s"),LPCWSTR(temp))


here XYZ is a query for getting name from database where it matches, I am using VS 2019
for this
Even after Ignoring the warning when i run the code i get access violation reading Exception.

What I have tried:

1. I tried to convert the CString which is temp to LPCWSTR
2. I have created diffrent class for ODBC connection and diffrent class for the query implementation.
Posted
Updated 29-Mar-22 1:02am
v2
Comments
Richard MacCutchan 29-Mar-22 7:54am    
What is temp defined as?
Shivam Kumar singh 007 29-Mar-22 22:21pm    
temp is a CString object.
Richard MacCutchan 30-Mar-22 3:39am    
There is still quite a bit of information missing from the question. Please show the actual code where the error occurs (not just a single line out of context), and the complete error message.

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