I have a table with primarykey in MS SQL 2005, which has a few hundred thousand records. When I query it in Management studio for a record, it brings very quickly but when i use code below to find it, it takes many seconds. It is must for me to use dataset as i need to update the row. How can i improve the performance?
objData . ProcName ="myProcName"
objData . CreateCommand()
objData . Parameters("@BName", SqlDbType. VarChar, 20, "MyBranch1")
SqlDataAdapter da = objData . createAdapter()
da . Fill(ds,"MyTable1")
While the proc code is very simple:
select * from MyTable1 Where BranchName = @BName
this dataset is gonna have 5 tables opened the same way so total time is more than a minute
You should consider using datareader instead of dataset and do a manual update using sqlcommand.
U should also consider restricting the number of records you are fetching by possibly supplying additional criteria