Hey everyone,
I have a VB2005 project with a SQL Mobile database. The database is rather large.
I've created parameterized queries to load grids and selected the grid task to Generate Data Forms. I delete the New menu option and the editable form. I am just using the detail form that opens when a record in the grid is selected.
My problem is that when I click on a record on the main grid during testing, it takes an extremely long time to open the detail form and populate the labels from the corresponding fields. When I originally did this in VB2003, I hand coded everything, and the searching and loading was much, much faster.
I like the auto-generated code, and I really do not want to have to recode everything by hand so that I can use a SQL Mobile database. Is there anything I can do to optimize the performance of this code I've already indexed all the tables to death. I don't believe there is anything else I can do to streamline the database.
Has anyone else worked with the automatically-generated features in VS2005
Thanks,
Lee

Auto-generated Code
GrandpaBob
Well, TblLocationsTableAdapter.Fill() will read all locations in details form, while you need only one. If you have many locations - this can hit performance.
James_Lin
I do have a lot of locations. Should I change it to a FillBy sp and pass a unique value from the first line of code
Considering that I am going from a grid on one form to another form, what would be the best way of passing that value
Lee
lmaster
More info on how to do this can be found here:
http://msdn2.microsoft.com/en-us/library/ms180744.aspx
CEisen
Yes, make another query (FillBy) to limit locations you read.
Another way is not read locations at all, but copy from the original dataset or use original dataset, just load in there details.
Martin Richter
Hi!
If you use DataAdapters, then you can add queries to them to limit rows only to thoose you need. For example, you have Customer table with 1000 rows and Order table with 10 000 rows (10 per customer). If you use autogenerated adapter - it will load for your 1 customer all 10 000 orders and filter them later. If you make query that accept Customer ID and limit result set to his orders only - you will get better performance.
Heath Stewart - MSFT
You could use SqlCeResultSet class which was designed especially to improve performance in cases like this one. Designers could generate typed ResultSet instead of DataSet for you (MSResultSetGenerator).
arthaskucarr
Yes,
I am already filtering the data for just what I need. But even on just the detail page that only shows the one selected record, it takes way too long to load the form.
Thanks
Lee
Black Virus
Do you handle events there On load it can make you speed-down.
Also you can try use BeginLoadData()/EndLoadData() and SuspendBinding()/ResumeBinding() on tables and binding sources. And you can limit the fields in queries to only that one you need.
Jackie Pritchard
Okay, here is the code that is automatically generated.
This code governs the click-event on the main form that has the data grid:
Private Sub TblLocationsDataGrid_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TblLocationsDataGrid.ClickEnd Sub
This is the code on the secondary form load event:
Private Sub tblLocationsSummaryViewDialog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadTry
Catch ex As System.Exception
End Try
End Sub
Does this look like the most efficient way to load a detail record from a grid on a previous form This is completely different from the way I did it in VS2003.
Thanks,
Lee