2009/2/8 Farhan Farooqui <[email protected]>

> Can you tell me how can i *UnSubscribe* from  [DotNetDevelopment] ?
>
> Awaiting your response.
>
> Rgds,
> *Sheikh Muhammad Farhan ul Haq Farooqui*
>
>
>
>
> --- On *Sun, 2/8/09, Nacho108 <[email protected]>* wrote:
>
>
> From: Nacho108 <[email protected]>
> Subject: [DotNetDevelopment] Re: Threading
> To: "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
> Services,.NET Remoting" <[email protected]>
> Date: Sunday, February 8, 2009, 6:23 AM
>
>
> Thanks for the advice! I will keep it in mind
>
>
> On Feb 7, 2:54 pm, Sreenivas 
> <[email protected]<http://us.mc01g.mail.yahoo.com/mc/[email protected]>>
> wrote:
> > >>> cmd.CommandText = "sp_FooBar";
> >
> > FYI,Don't use "sp_" prefix for stored procedure names ,bcoz sql server
> > checks system stored procedures(e.g:sp_executesql,sp_helptext ) to see
> > it first,then it comes to execute user written stored procs .So its an
> > overhead you are adding to your sql server.
> >
> > On Feb 7, 2:04 am, AstroDrabb 
> > <[email protected]<http://us.mc01g.mail.yahoo.com/mc/[email protected]>>
> wrote:
> >
> > > On Thu, Feb 5, 2009 at 7:00 AM, Nacho108 
> > > <[email protected]<http://us.mc01g.mail.yahoo.com/mc/[email protected]>>
> wrote:
> >
> > > > Hi everyone!
> >
> > > > I'm trying to start using threads in this application I'm making and
> > > > I'm having some problems.
> > > > The task is simple: I want to read a database with 200000 records
> > > > that's situated in another PC, so it takes some seconds. Then I want
> > > > to show them in a datagridview control.
> > > > The thing is that I'm trying to fill a dataset which I define in the
> > > > main thread and I cannot access it within the "worker" thread, and If
> > > > I define it within the worker thread I cannot send it to the main
> > > > thread.
> >
> > > > Can somebody explain to me how people solve this problem?
> >
> > > > Thanks!!
> > > > Nacho
> >
> > > As Steve pointed out, cross-thread stuff needs to be handled
> differently.
> >
> > > Do you just want a nice way to wait for the DB to return the records
> without
> > > the interface locking up?
> >
> > > If so, you can use an async call for a resultset.
> >
> > > For MS SQL Server, you need to add ";Asynchronous Processing=true" to
> > > your connection
> > > string.
> >
> > > Then do something like:
> >
> > > int counter = 0;
> > > SqlCommand cmd = new SqlCommand();
> > > cmd.CommandType = CommandType.StoredProcedure;
> > > cmd.CommandText = "sp_FooBar";
> >
> > > cmd.Parameters.Add();  // add any params you need
> >
> > > cmd.CommandTimeout = 0;
> > > IAsyncResult result = cmd.BeginExecuteNonQuery();
> > > while (!result.IsCompleted)  // wait till sproc is done
> > > {
> > >     DoSomethingWhileWeWaitLikeSleepOrDoEventsEtc();}
> >
> > > cmd.EndExecuteNonQuery(result);
>
>
>

Reply via email to