Modify the SQLstring to SELECT....WHERE... or probably even better: use a parameter for the stored procedure. -- Lasse Löfström -----Ursprungligt meddelande----- Från: The DOTNET list will be retired 7/1/02 [mailto:[EMAIL PROTECTED]]För Andreas Håkansson Skickat: den 15 juni 2002 01:31 Till: [EMAIL PROTECTED] Ämne: [DOTNET] Performence of SqlDataAdapter.Fill
I'm currently writing a class that acts as a collection that sits ontop of a database, i.e it fetches the data from the database when it's requested. I'm adding an indexer to my class to get item x, which also means row x in the query result. What I'm doing now is use a SqlCommand setup to call my stored procedure and then I set the SelectCommand property of the SqlDataAdapter and do something like this public object this[int index] { get { // Set up my SqlCommand to call my sp SqlDataAdapter myAdapter = new SqlDataAdapter(); myAdapter.SelectCommand = myCommand; DataSet myDataSet = new DataSet(); myAdapter.Fill(myDataSet, index, 1, "results"); // create an object and populate it with the // results..then return it.. return newObject; } } What I'm concerned with is if the overload of the Fill method actually gets the entire resultset and then grabs the row I asked, thus transfering the entire result into my app which means a waste of network traffic. If so, then are there any better ways of doing this? -- Andreas Håkansson Student of Software Engineering andreas (at) selfinflicted.org In a world in which we are all slaves to the laws of gravity, I'm proud to be counted as one of the freedom fighters. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.