Back at your other question
Unhandled Exception / Access Violation[
^] I told you that you needed to handle all the error conditions and not just rely on the record set containing 0. Now you're back with the exact same program and still no handing of error conditions.
If you are doing calls, you need to realize that every call can FAIL miserably and you need to handle the failure return from the function. Only if it SUCCEEDS can you look at the data to see if the data says everything is OK. In other words, you need to deal with two types of FAILURES, 1) the overall operating system telling you that your call didn't work. 2) the application (mysql) telling you that the call worked but the data returns a different result than you expected. Deal with both.
Once you handle errors, you can decide how to make the program continue / recover or not.
Added an Example
The documentation for
mysql_query
says it can return non-zero if any number of errors occur, including
CR_SERVER_GONE_ERROR
or
CR_SERVER_LOST
. You'll need code like this (and don't try to paste it, I'm just typing it in, no compiler here)
int q_result = mysql_query(conn, queryString);
if (q_result != 0)
{
}
res_set = mysql_store_result(conn);
if (res_set == NULL)
{
}