Home > Software engineering >  Using messagebox test reading the database content is correct?
Using messagebox test reading the database content is correct?

Time:10-31

//the following are defined in the function of content (can be ignored, if the definition of the following functions are not understand can consult) 
MYSQL * MYSQL;
MYSQL_RES * res;
MYSQL_ROW row;
Char * query;
int t;

//the following is the function inside the content of the
Query="select * from jobs where instanceid='car1'";
Mysql_query (mysql, query);
Res=mysql_store_result (mysql);//save the results in the res structure

T=mysql_affected_rows (mysql);//the jobs data table, instanceid=car1 data a total of the number of rows
The row=mysql_fetch_row (res);//I'm here for each line of data
for (int i=0; i {
MessageBox (NULL, TEXT (row [I]), TEXT (" database "), MB_OK);
}//but only read the first line of data, the program can not run down

I use vs2013, c + + MFC application, single document (haven't contact with c + + MFC programming, foundation is very poor) after running the program interface is like this:


How to obtain each line of data, and store it, I use the above row=mysql_fetch_row (res); I don't know right

Then watch read data is correct, I use above messagebox

Behind me function is to deal with these data, so just want to test the success of access, it doesn't have to be to interface display data table of contents,
If anyone has greatly display data table content code is best, can you give me up,

CodePudding user response:

Do not use
MessageBox
Displayed directly within the view
Or stored to a file

CodePudding user response:

You used to look at the TRACE output directly, the Debug mode

CodePudding user response:

 OutputDebugString 

CodePudding user response:

Direct recording disc, such as saving into a TXT file, very convenient, don't have my work computer, or stick a give you,,,
  • Related