| |

VerySource

 Forgot password?
 Register
Search
View: 2070|Reply: 16

A long time-out problem that entangled me ...

[Copy link]

4

Threads

24

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-1-10 23:20:01
| Show all posts |Read mode
The timeout period has expired. The timeout period elapsed or the server did not respond before the operation completed.

Explanation: An unhandled exception occurred during the execution of the current web request. Check the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: The timeout period has expired. The timeout period elapsed or the server did not respond before the operation completed.

Source error:


Line 24: protected void BindCartData ()
Line 25: {
Line 26: mysqlSqlConnection.Open (); // this line is wrong
Line 27: SqlDataAdapter mysqlSqlDataAdapter1 = new SqlDataAdapter ("select top 2 * from aspnet_PhoneItem where Type = 'Music'", mysqlSqlConnection);
Line 28: SqlDataAdapter mysqlSqlDataAdapter2 = new SqlDataAdapter ("select top 2 * from aspnet_PhoneItem where Type = 'Smart'", mysqlSqlConnection);

Source file: f:\Self-made code\MobileBox\Default.aspx.cs Line: 26
Reply

Use magic Report

0

Threads

60

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-1-14 10:45:01
| Show all posts
Wrong SQL statement

SqlDataAdapter mysqlSqlDataAdapter1 = new SqlDataAdapter ("select top 2 * from aspnet_PhoneItem where Type = 'Music'", mysqlSqlConnection);


to
SqlDataAdapter mysqlSqlDataAdapter1 = new SqlDataAdapter ("select top 2 * from aspnet_PhoneItem where Type =" + "music", mysqlSqlConnection);



 SqlDataAdapter mysqlSqlDataAdapter2 = new SqlDataAdapter ("select top 2 * from aspnet_PhoneItem where Type =" + "Smart", mysqlSqlConnection);

to
 SqlDataAdapter mysqlSqlDataAdapter2 = new SqlDataAdapter ("select top 2 * from aspnet_PhoneItem where Type =" + "Smart", mysqlSqlConnection);
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-14 11:09:02
| Show all posts
This problem is rare when the hardware configuration is better. . .
Reply

Use magic Report

0

Threads

25

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-1-14 14:36:02
| Show all posts
mysqlSqlConnection.ConnectionTimeout = 100
If not set, the default is 15 seconds,
Reply

Use magic Report

0

Threads

64

Posts

35.00

Credits

Newbie

Rank: 1

Credits
35.00

 United States

Post time: 2020-1-14 18:00:02
| Show all posts
You can switch to SQLite, which is also free.
Reply

Use magic Report

0

Threads

119

Posts

67.00

Credits

Newbie

Rank: 1

Credits
67.00

 China

Post time: 2020-1-15 14:09:01
| Show all posts
mysqlSqlConnection.ConnectionTimeout is longer!
Reply

Use magic Report

4

Threads

24

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

 Author| Post time: 2020-1-15 17:00:01
| Show all posts
mysqlSqlConnection.ConnectionTimeout = 100
If not set, the default is 15 seconds,

An error occurred`
Cannot assign a value to the property indexer System.Data.Common.Dbconnection.ConncetionTimeout-it is read-only
Reply

Use magic Report

0

Threads

32

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-1-16 13:09:01
| Show all posts
SqlDataAdapter.selectcommand.CommandTimeout = 0;
Reply

Use magic Report

1

Threads

60

Posts

37.00

Credits

Newbie

Rank: 1

Credits
37.00

 China

Post time: 2020-1-16 20:00:02
| Show all posts
Connection pool with server database
Setting mysql SqlConnection.ConnectionTimeout
Reply

Use magic Report

0

Threads

32

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-1-17 11:09:01
| Show all posts
It is not a connection timeout, but a command execution timeout.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list