Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 12th, 2006, 03:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default Loading Lots of Data

Hello,

I'm loading a lot of data into the API; is there a way I can make that asyncronous, so I don't have to wait in the application the whole time while it loads? I know of the background worker control, but I'm in the API and not doing this in a windows form. What approach should I use? I'm using SQL Server express database.

Thanks.

Brian
__________________
Brian
  #2 (permalink)  
Old January 28th, 2008, 12:57 PM
Authorized User
 
Join Date: Dec 2004
Location: Swindon, Wilts, United Kingdom.
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DZukiewicz
Default

You can you BeginExecuteReader and then EndExecuteReader to do the query.

Code:
SqlConnection sqlConn = new SqlConnection( ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString );

using(SqlCommand comm = new SqlCommand())
{
     comm.CommandType = CommandType.Text;
     comm.CommandText = "Select * from tblBig";

     IAsyncResult res = comm.BeginExecuteReader();

     /////// Do your long operation

     SqlDataReader dr = comm.EndExecuteReader(res);

     //Enquire data.
}
Hope this helps,

Dominic
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New to ASP.NET and lots of problems Lessa ASP.NET 1.0 and 1.1 Basics 7 April 29th, 2008 07:05 AM
Loading Entity /w No Data pinch BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 January 20th, 2008 02:27 AM
Loading data from SQL levinll Pro VB Databases 0 January 25th, 2007 04:09 PM
Lots of errors and no solutions.... i8226girl BOOK: Beginning Access VBA 3 September 20th, 2005 05:43 AM



All times are GMT -4. The time now is 12:11 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.