Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
The timeout period elapsed prior to completion of the operation or the server is not responding.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: MySql.Data.MySqlClient.MySqlException: Timeout expired. The
Description: getting an error on con.open();

Error: timeout period elapsed prior to completion of the operation or the server is not responding.

Source Error:



C#
Line 35:                     {
Line 36:                       
Line 37:                         con.Open();
Line 38:


What I have tried:

C#
using (MySqlConnection con = new MySqlConnection("Data Source = 92.80.422.422;User ID = mide; Password = Mfggggh0; database = tt"))
            {
con.open();
                //Open the connection
                if (TextBox1.Text == "Mi" & TextBox2.Text == "ukm")
                {
                    
                    Response.Redirect("Pd.aspx");

                }
Posted
Updated 5-Nov-19 21:39pm
v3

1 solution

Read the error message:
timeout period elapsed prior to completion of the operation or the server is not responding.

At a guess, the server is not responding.
Check your connection string, make sure that it works - the chances are that the IP address you are using is not available from that location.

And two things:
1) Change your id / password setup: you just told 14,000,000 people how to log in to your DB and do what they want...
2) Don't hardcode connection strings: they need to be in a configuration file. If for no other reasons that you very definitely should not be testing code against a production DB, and shouldn't release untested code ...
 
Share this answer
 
Comments
OriginalGriff 6-Nov-19 6:35am    
You could try this:

https://www.codeproject.com/Tips/1198443/Simple-SQL-Connection-String-Creation

I don't know if it works with MySql DB's though - if the engine is installed it probably should.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900