How the heck do you expect us to know. It's YOUR DLL and YOUR error message. Did you post ANY code? No mind readers here.
Did you compile YOUR DLL with the proper calling parameters, from MQL4 to yours and from your to libmysql?
#property copyright "Copyright ?2006, GP2X" #property link "" #define DELIM ";" #import "C:\MYSQL5\bin\libmysql.dll" int mysql_init(int db); int mysql_errno(int TMYSQL); int mysql_real_connect( int TMYSQL,string host,string user,string password, string DB,int port,int socket,int clientflag); int mysql_real_query(int TMSQL,string query,int length); void mysql_close(int TMSQL); int mysql_store_result(int TMSQL); string mysql_fetch_row(int result); int mysql_num_rows(int result); void mysql_free_result(int result); int mysql; int mTicket, mType; string mSymbol; double mLots, mOpen, mClose, mStopLoss, mTakeProfit; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { string row; connect(); string query="Select concat(';',concat_ws(';', ticket, symbol, type, lots, open, close, stoploss, takeprofit)) from trades"; Print("query = " + query); int length=StringLen(query); mysql_real_query(mysql,query,length); int result = mysql_store_result(mysql); int numOfRows = mysql_num_rows(result); for (int i=0;i<numOfRows;i++) { row = mysql_fetch_row(result); decodeTrade(row); Comment("Ticket=", mTicket, ",Symbol=", mSymbol, ",Type=", mType, ",Lots=", mLots, ",Open=", mOpen, ",Close=", mClose, ",SL=", mStopLoss, ",TakeProfit=", mTakeProfit); } mysql_free_result(result); return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { mysql_close(mysql); return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- //---- return(0); } //+------------------------------------------------------------------+ void connect() { mysql = mysql_init(mysql); if (mysql!=0) Print("allocated"); string host="localhost"; string user=""; string password=""; string DB="mt4"; int clientflag=0; int port=3306; string socket=""; int res=mysql_real_connect(mysql,host,user,password,DB,port,socket,clientflag); int err=GetLastError(); if (res==mysql) Print("connected"); else Print("error=",mysql," ",mysql_errno(mysql)," "); } void decodeTrade(string trade) { int begin = StringFind(trade, DELIM)+1; int end = StringFind(trade, DELIM, begin); mTicket = StrToInteger(StringSubstr(trade, begin, end-begin)); begin = end+1; end = StringFind(trade, DELIM, begin); mSymbol = StringSubstr(trade, begin, end-begin); begin = end+1; end = StringFind(trade, DELIM, begin); mType = StrToInteger(StringSubstr(trade, begin, end-begin)); begin = end+1; end = StringFind(trade, DELIM, begin); mLots = StrToDouble(StringSubstr(trade, begin, end-begin)); begin = end+1; end = StringFind(trade, DELIM, begin); mOpen = StrToDouble(StringSubstr(trade, begin, end-begin)); begin = end+1; end = StringFind(trade, DELIM, begin); mClose = StrToDouble(StringSubstr(trade, begin, end-begin)); begin = end+1; end = StringFind(trade, DELIM, begin); mStopLoss = StrToDouble(StringSubstr(trade, begin, end-begin)); begin = end+1; end = StringLen(trade); mTakeProfit = StrToDouble(StringSubstr(trade, begin, end-begin)); }
user=root solved the problem
mysql = mysql_init(mysql); if (mysql!=0) Print("allocated"); string host="localhost"; string user="root"; string password="";
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
follow the instructions in:
https://forum.mql4.com/16915#121444
advisor to initialize exeprt Experts on the I get the following errors
what is the problem?