我得到这个错误:SQL调用超时 - Asp.net
The wait operation timed out
而且它发生在这条线:
public static DataTable Get_Table_Grouped()
{
DataTable result = new DataTable();
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["My_Data"].ConnectionString))
{
using (SqlCommand cmd = new SqlCommand(@"
SELECT TOP 10 Attribute1, Attribute2, Attribute3, Attribute4, Attribute5,
Sum([Attribute6]) As Attribute6
FROM My_Table
group by Attribute1, Attribute2, Attribute3, Attribute4, Attribute5", con))
{
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(result);
con.Close();
da.Dispose();
}
}
return result;
}
以下:
da.Fill(result);
在下面的代码是我的连接字符串“My_Data”
<add name="My_Data" connectionString="Data Source=Database_Location;User ID=username;Password=my_password;" providerName="System.Data.SqlClient"/>
我能做些什么来解决这个问题?有没有办法阻止超时?当我在Microsoft SQL Server中直接尝试相同的查询时,它可以正常工作,但过了一段时间后,我的代码中看不到任何可导致超时的内容