我有一个小问题,希望有人能给我一些建议。我正在运行一个 SQL 命令,但由于数据量很大,这个命令似乎需要大约 2 分钟才能返回数据。但是默认连接时间是 30 秒,我如何增加这个,并将它应用到这个命令?
public static DataTable runtotals(string AssetNumberV, string AssetNumber1V)
{
DataTable dtGetruntotals;
try
{
dtGetruntotals = new DataTable("Getruntotals");
//SqlParameter AssetNumber = new SqlParameter("@AssetNumber", SqlDbType.VarChar, 6);
//AssetNumber.Value = AssetNumberV;
SqlParameter AssetNumber = new SqlParameter("@AssetNumber", SqlDbType.VarChar, 10);
AssetNumber.Value = AssetNumberV;
SqlParameter AssetNumber1 = new SqlParameter("@AssetNumber1", SqlDbType.VarChar, 10);
AssetNumber1.Value = AssetNumber1V;
SqlCommand scGetruntotals = new SqlCommand("EXEC spRunTotals @AssetNumber,@AssetNumber1 ", DataAccess.AssetConnection);
// scGetruntotals.Parameters.Add(AssetNumber);
scGetruntotals.Parameters.Add(AssetNumber);
scGetruntotals.Parameters.Add(AssetNumber1);
SqlDataAdapter sdaGetruntotals = new SqlDataAdapter();
sdaGetruntotals.SelectCommand = scGetruntotals;
sdaGetruntotals.Fill(dtGetruntotals);
return dtGetruntotals;
}
catch (Exception ex)
{
MessageBox.Show("Error Retriving totals Details: Processed with this error:" + ex.Message);
return null;
}
}