I would prefer to see the circle going around for awhile. (Possibly something I change to tell the person to wait).
Recently:I changed the stored procedure to use 'nolock' on a few tables that are joined. This way I at least get the results I want.
The question is: What .net feature would I need to change for thsi problem to go away?
This application uses a data adapter visual designer to connect to a sql server 2008 R2 database.
For additioanl information, the following is some of the code that is autogenerated:
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public partial class brw_TableAdapter : global::System.ComponentModel.Component {
private global::System.Data.SqlClient.SqlDataAdapter _adapter;
private global::System.Data.SqlClient.SqlConnection _connection;
private global::System.Data.SqlClient.SqlCommand[] _commandCollection;
private bool _clearBeforeFill;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public brw_TableAdapter() {
this.ClearBeforeFill = true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)]
public virtual Browser.brw_DataTable GetDataTable(global::System.Nullable
this.Adapter.SelectCommand = this.CommandCollection[0];
if ((submissionId.HasValue == true)) {
this.Adapter.SelectCommand.Parameters[1].Value = ((int)(CO.Value));
}
else {
this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value;
}
CO.brw_DataTable dataTable = new CO.brw_DataTable();
this.Adapter.Fill(dataTable);
return dataTable;
Amit ChoudharyPosted Aug 8, 2011, 3:21 AM
This is a common problem seen with the applications dealing with heavy data. Simple approach to prevent the window UI from freezing and showing the notification for loading is to use Threading.
What i suggest you to load the grid in a separate thread and until the threads completes loading grid you can show a loading symbol on the UI.
Here is the article that'll help you understanding the Wait and Notify concept in threading. article is for .Net 4.0 if you are using earlier version try delegates BeginInvoke() and EndInvoke() for making and async request in a separate thread see these articles here.
http://www.cshandler.com/2011/07/delegates-and-async-programming-part-i.html
http://www.cshandler.com/2011/07/delegate-and-async-programming-part-ii.html
Make sure while creating thread it should be invoke in async manner other wise UI freeze problem will not get resolved.
hope this was helpful.