>After more research, I have isolated the line which is making everything slow.
>
>This is the function I have:
>
>
> ' SQL adapter into a DataSet
> ' expC1 SQL command
> ' expC2 Path of the table
> Public Shared Function VFPSQLAdapterDataSet(ByVal tcSQL As String, ByVal tcTable As String) As DataSet
> Dim loData As DataSet
>
> loData = New DataSet
> Dim loDT As New OleDbDataAdapter(tcSQL, _
> "Provider=VFPOLEDB.1;Data Source=" + tcTable + ";Password='';Collating Sequence=MACHINE")
>
> loDT.Fill(loData, "Temp")
>
> Return loData
> End Function
>
>
>When executed only once, it doesn't matter. But, when this is executed such as 20 times, I see a big drop of result time. Basically, if I comment the line loDT.Fill(loData, "Temp"), everything is fast. Even at 20 times, this will be immediately processed. Is there another way to fill the dataset in order to have it immediately?
First, I think this is creating a connection each time you call it. That may be slowing things up a bit. You may try to create a connection object and pass it into this funtion each time.
Secondly, as I said previously, instead of passing in a query that gets 1 record at a time 50 times, can you pass one query that gets all records, then loop through the data set.
Third, you might want to try to get a data reader rather than a data set.
Finally, you may want to use a ExecuteScaler against and SP to get your single record.
Just a few ideas to try.
BOb