List:General Discussion« Previous MessageNext Message »
From:Bill Heckel Date:April 20 1999 6:34pm
Subject:Getting server error 127 after insert.
View as plain text  
What causes the 127 error after an insert?

===

Here is the code snippet that causes the error


 MYSQL_RES *SQLres=NULL;
 sprintf(sql,"select * from user where login_name=\"%s\"",login_name);
 SQLres = dlg->SQLdatabase->ExecuteSQL(sql);
 if (SQLres) 
   {
    i= mysql_num_rows( SQLres );
    mysql_free_result(SQLres);
   }
  else
   {
    sprintf(msg,"Potential ERROR, SQLres from query (%s) is NULL.",sql);
    dlg->ShowStatus(msg);
   
sprintf(msg,"ErrorString=%s",mysql_error(&(dlg->SQLdatabase->Data)));
    dlg->ShowStatus(msg);
    i=0;
   }
 if (i=0)
   {
    int countryID=0;
    sprintf(sql,"select countryid from countries where name =
\"%s\"",country);
    MYSQL_RES *SQLres2 = dlg->SQLdatabase->ExecuteSQL(sql);
    if (SQLres2)
     {
      MYSQL_ROW row;
      int i= mysql_num_rows( SQLres2 );
      if (i>0)
       {
        row = mysql_fetch_row( SQLres2 );
        countryID=atoi(row[0]);
       }
      mysql_free_result(SQLres2);
     }
    sprintf(sql,"%s  is a new user, creating user entry",login_name);
    dlg->ShowStatus(sql);
    sprintf(sql,"INSERT INTO user VALUES
(0,'%s','%s',NULL,'%s','%s','%c','%d-%d-%d',%d,'%s')",
                                           
login_name,login_pw,last_name,first_name,sex,(int)(*(WORD
*)(birthdate+2)),
                                            (int)(*(char *)(birthdate)),
					    (int)(*(char *)(birthdate+1)), 
                                            (int)countryID,zip);
    SQLres2 = dlg->SQLdatabase->ExecuteSQL(sql);
    if (! mysql_affected_rows(&(dlg->SQLdatabase->Data)))
     {
      dlg->ShowStatus("ERROR:  User not added!");
     }
    if (SQLres2) mysql_free_result(SQLres2);
   }
Thread
Getting server error 127 after insert.Bill Heckel20 Apr