I have a SqlDataAdapter that is being populated with 33k rows of data (about 15 columns). When running query in MS SSMS, i get my rows in about 5 sec. When using my code, I get a timeout, even by setting the timeout parameter to 120 sec :
private static DataTable getResult(string query, int someId, SqlConnection myConn)
{
SqlCommand myCmd = new SqlCommand(query, myConn);
SqlDataAdapter da = new SqlDataAdapter();
DataTable dt = new DataTable();
myCmd.Parameters.Add("@someId", SqlDbType.Int);
myCmd.Parameters["@someId"].Value = someId;
da.SelectCommand = myCmd;
da.SelectCommand.CommandTimeout = 120;
da.Fill(dt);
return dt;
}
I've already tried advices from websites such as getting higher connection numbers, and timeout values with no result to this day ...
Any ideas on how to avoid the timeout error ?
Thanks for your insights.