QUOTE(narf03 @ Nov 16 2023, 12:01 AM)
no loop, something like this
CODE
private static DataSet SelectRows(DataSet dataset,
string connectionString,string queryString)
{
using (SqlConnection connection =
new SqlConnection(connectionString))
{
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = new SqlCommand(
queryString, connection);
adapter.Fill(dataset); // <----- huge delay here.
return dataset;
}
}
Hmm, ok, got it. Low level wireshark or tcpdump might help.
On the other hand, your use of DataAdapter might be problematic:
https://learn.microsoft.com/en-us/dotnet/fr...m-a-dataadapterSee the note, copy pasted here:
QUOTE
Using the DataAdapter to retrieve all of a table takes time, especially if there are many rows in the table. This is because accessing the database, locating and processing the data, and then transferring the data to the client is time-consuming. Pulling all of the table to the client also locks all of the rows on the server. To improve performance, you can use the WHERE clause to greatly reduce the number of rows returned to the client. You can also reduce the amount of data returned to the client by only explicitly listing required columns in the SELECT statement. Another good workaround is to retrieve the rows in batches (such as several hundred rows at a time) and only retrieve the next batch when the client is finished with the current batch.
It appears that it not only selects the data, but prepares them individually for updates, locking up the table in the db. Don't know what it does, but Fill() in itself might be the cause of the latency.
Might well be a specific .NET and SQL Server thing, which is out of my depth. Good luck.
This post has been edited by angch: Nov 16 2023, 01:24 AM