patterncsharpMinor
Fill a DataSet with nearly 20,0000 records using SqlDataAdapter
Viewed 0 times
nearlysqldataadapterwithrecordsdataset0000usingfill
Problem
I want to fill a
If I fill a
This is my code:
DataSet with 20,0000 records using a SqlDataAdapter by using this code:adapter.Fill(dataset);If I fill a
DataSet this way it takes a long time. Is there anything wrong with this?This is my code:
connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
connection.Open();
SqlCommand command = new SqlCommand("sp_DMS_Report_Generate", connection);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@XML", reportCriteria.XML);
command.CommandTimeout = 1000;
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(resultSet);
return resultSet.Tables[0];Solution
I would say the C# is fine, it's your database that is the issue. Is the Stored procedure optimized? Are the tables in the proper normalization? Are your primary keys & foreign keys set up properly? (you should get the point by now)
Start there first since really everything is there.
Start there first since really everything is there.
Context
StackExchange Code Review Q#4760, answer score: 3
Revisions (0)
No revisions yet.