System.Data.SqlClient.SqlConnection conec = new System.Data.SqlClient.SqlConnection("data source=" + servidor + "; initial catalog=" + basedatos + "; user id=" + usuario + "; password=" + contra + "; Connect Timeout=1500; Packet Size=32767; ");
that is my connection but i got timeout value expired
i changed it to 0 and i got the same message
but when i changed it to my sqlcommand
System.Data.SqlClient.SqlCommand comando = new System.Data.SqlClient.SqlCommand(consulta, conexion);
comando.CommandTimeout = 0;
it works ok, why doesn´t it work if i have 0 in my connection string? what is
the difference? i have listen about connection lifetime but i don’t have idea about it.
Try using:
instead of:
(From the documentation.)