Error Access violation read to 0x00000000

 
I have made a EA to get some data and insert it into my sql database but I got this error when I try to insert  , the insert function is in a timer .


    bool insertMt4Finance(){
          string queryInsertMt4String;
     
    
    
         if(userExist()){ 
    
       string serveur,currency,createdon,login;    double firstdeposit;    serveur  = (string)AccountInfoString(ACCOUNT_SERVER);    currency  = (string)AccountInfoString(ACCOUNT_CURRENCY);      createdon = TimeToString(TimeLocal(), TIME_DATE|TIME_SECONDS);            login = (string)AccountInfoInteger(ACCOUNT_LOGIN);    firstdeposit = AccountInfoDouble(ACCOUNT_BALANCE);
           double profit,credit;    profit  = AccountInfoDouble(ACCOUNT_PROFIT);    credit  = AccountInfoDouble(ACCOUNT_CREDIT);
       
           queryInsertMt4String = "INSERT INTO `MT4_FINANCE`(mt4_finance_uid,mt4_id,mt4_balance,mt4_profit,mt4_bonus,mt4_financeDate) VALUES ("+ GetUniqueInstanceName(login) + "," + login + "," + firstdeposit + "," + DailyProfit() + "," + credit + ",'" + createdon + "')";    uchar queryInsertMt4[];    StringToCharArray(queryInsertMt4String,queryInsertMt4,0,StringLen(queryInsertMt4String));
           int length=StringLen(queryInsertMt4String);    mysql_real_query(mysql,queryInsertMt4,length);
           Print("Row Insert Success, insertMt4Finance");    return true;
           }else { Print("Account Does Not Existe , insertMt4Finance");    return false;    }
    
    
    

    }







I thinks is a error from the SQL file DLL: 

This error appear on expert section on MT4

   Error Access violation read to 0x00000000


Thanks 

 
How to Access the MySQL Database from MQL5 (MQL4)
How to Access the MySQL Database from MQL5 (MQL4)
  • www.mql5.com
The article describes the development of an interface between MQL and the MySQL database. It discusses existing practical solutions and offers a more convenient way to implement a library for working with databases. The article contains a detailed description of the functions, the interface structure, examples and some of specific features of working with MySQL. As for the software solutions, the article attachments include the files of dynamic libraries, documentation and script examples for the MQL4 and MQL5 languages.
 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.