Page 1 of 1

Lost connection to MySQL server during query

Posted: Tue 24 Mar 2020 19:52
by UR-IT
<add name="carmenrichter_gx2DataContextConnectionString" connectionString="User Id=xxxxx;Password=pw;Host=host_ip=carmenrichter_gx2;Persist Security Info=True;Ping Interval=240" />

This is the connection String. The host is a remote webserver.

What ever i do, i get the timeout ....

_product = GlobalData.RemoteDataContext.Products.SingleOrDefault(x => x.ProductsId == SelectedNI);

in things like that.

Re: Lost connection to MySQL server during query

Posted: Fri 27 Mar 2020 15:50
by Shalex
Set bigger value (by default, 30) in the Default Command Timeout connection string parameter.

Note that FirstOrDefault is faster than SingleOrDefault: https://stackoverflow.com/questions/318 ... ne-element.