|
Unfortunately that gives no clue as to where the exception occurred. So you will need to run the code in the debugger and step through it until you can find where it occurs, and why. Also note you have the following code:
catch (...)
{
if (pExcelDatabase)
{
delete pExcelDatabase;
}
return NULL;
}
So you are catching any exception but ignoring it, which is not a good idea. You need to put some proper code in there to get the type and reason information from the exception.
|
|
|
|
|
Message Closed
modified 1-Aug-22 10:39am.
|
|
|
|
|
Try answering the question you were asked about the exception.
|
|
|
|
|
Sorry for missing this question earlier.. i posted the exception details now.
|
|
|
|
|
Figured it out on my own. Things to be asked or answered.
1) My application is 32 bit.
2) I have MDAC 64 bit on my windows 64bit OS.
3) When the CDatabase OpenEx executes with connection string i mentioned in my above code, it checks in ODBC32.exe in which the required driver (xlsx) is not available.
4) We must have to install the MDAC 32 bit and the required driver to read the xlsx file is will be available.
Hope this answer will be helpful to others in future and thought of writing my analysis.
Regards
Sampath.
Questioning is an Art and Answering will be done by only an Artist.
|
|
|
|
|
What do I need to do to be able to use in C++ UTF8 characters for char * and std::string , or at least for std::string if char * doesn't support it? I'm using std:c++17. I tried the following code to see if it is working without changing anything but it didn't worked and returned ┬┴╩╦≡??Γε? :
#include <iostream>
#include <string>
int main() {
std::string a = "ÂÁÊËðșțâîă";
std::cout << a;
std::cin.get();
}
|
|
|
|
|
Couple of things:
1. UTF8 literal strings are written as this:
std::string a = u8"ÂÁÊËðșțâîă";
2. Support for UTF8 in regular CMD is VERY bad. I haven't tried much in the new Windows terminal.
3. You might find more stuff about UTF8 in my series of articles on CodeProject.
Mircea
|
|
|
|
|
Adding u8 worked, thanks. As for CMD it was used only as a testing display, I don't need it in the actual app, and for testing I ended up writing to a file to see if it is working. And where I actually used it, it did worked.
|
|
|
|
|
You need to set the correct codepage to print the characters from the appropriate set. See chcp | Microsoft Docs[^]. Code page 65001 works for me.
modified 27-Jul-22 10:53am.
|
|
|
|
|
Moved this question to the proper forum "Managed C++/CLI"
Feel free to delete i cant
modified 27-Jul-22 10:29am.
|
|
|
|
|
I guess you should have posted it into the Managed C++/CLI Forum.
|
|
|
|
|
Thanks Victor for explaining i s in the wrong forum
i did for look for a managed C++ CLI forum but i totaly failed
I will moved my question to the right one now :¬)
modified 27-Jul-22 10:32am.
|
|
|
|
|
After a long time not using C++, I picked it for a pet-project...
It works perfectly, but I have the feeling I use older solutions in my code, than those are available today. My code probably is pre C++11 (do we call it ANSI?)...
I'm looking for some reference material that can help me to learn the new and shiny things I may want to use in my code to make it faster, maintainable and readable...
“Real stupidity beats artificial intelligence every time.”
― Terry Pratchett, Hogfather
|
|
|
|
|
I use this for reference: cppreference.com[^]. But it may depend on how skilled you are at the basics of C++.
|
|
|
|
|
Thank you for the link - will investigate it...
(After COBOL, I used C++ solely for like 5-6 years, than for an other 2 years occasionally... So I'm not a master, but understand it fairly...)
“Real stupidity beats artificial intelligence every time.”
― Terry Pratchett, Hogfather
|
|
|
|
|
Kornfeld Eliyahu Peter wrote: I'm not a master Me too.
|
|
|
|
|
thanks for that link. Holy Crap, I still have a lot to learn.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
|
|
Thank You!
“Real stupidity beats artificial intelligence every time.”
― Terry Pratchett, Hogfather
|
|
|
|
|
How do you use a pointer to a function that is declared in the general scope within a class.
Do you pass the pointer as parameter to class function, save the pointer as a class member and then use the class member in a class function when needed?
void somefunction(int i);
void (*pointertosomef)(int i) = somefunction;
class SomeObject
{
void (*m_pointertosomef)(int i);
public:
void ImportPointerToF(void (*pointertosomef)(int i));
void UsePointerToF();
}
void SomeObject::ImportPointerToF(void (*pointertosomef)(int i))
{
m_pointertosomef = pointertosomef;
}
void SomeObject::UsePointerToF()
{
m_pointertosomef(30);
}
I found on the internet the basic version of declaring a pointer function
void fun(int a);
void (*fun_ptr)(int) = fun;
fun_ptr(10);
Everything else is my speculation
|
|
|
|
|
|
Does it compile, build and run without errors? The only caveat I would mention is that pointers to class methods require the method to be static.
|
|
|
|
|
ok, thanks to both of you.
Quote: Does it compile, build and run without errors
Usually I don`t try to compile wild guesses. I did things as you would do with a pointer in my post above but often in c++ things that resemble in some places don`t have a syntax that matches everywhere.
modified 16-Jul-22 10:16am.
|
|
|
|
|
Calin Cali wrote: Usually I don`t try to compile wild guesses.
Well, you should because:
1. Might take less time than waiting for an answer.
2. Compiler is never cranky or in a bad mood. At most it will issue an error message.
3. One wild guess leads to another and soon you end up with a nice brilliant idea
Mircea
|
|
|
|