thanks for u r reply please give your reply for below program.
For table creation and insertion i am using these string.
Create table mystudents(sname varchar(50),sno varchar(25),mark1 numeric,mark2 numeric); insert into mystudents values('lala','tk001',100,100);
VC+++
CString("select * from mystudents;") int status = mysql_query(hnd,sql); if (status) { printf("Could not execute statement(s)"); mysql_close(hnd); //exit(0); } int lIntRow=0; MYSQL_RES *result=NULL; MYSQL_ROW row; // one row returned int numfield=0; // process each statement result
result = mysql_store_result(hnd);
if (result)
{
// yes; process rows and free the result set
//process_result_set(hnd, result);
if (result)
{
row = mysql_fetch_row(result);
numfield = mysql_num_fields(result); //wrong return value
}
else
{
//fprintf(stderr,"Failed to use the result acquired!\n");
return 0;
}
mysql_free_result(result);
}
else // no result set or error
{
if (mysql_field_count(hnd) == 0)
{
printf("%lld rows affected\n",
mysql_affected_rows(hnd));
}
else // some error occurred
{
printf("Could not retrieve result set\n");
break;
}
}
while i try to get details from table my using above VC++ code i am getting 1542852 or 14253689 values insteadof 1 from mysql_num_fields.