PC Review


Reply
Thread Tools Rate Thread

Asynchronous data access in ASP.NET

 
 
vpidatala@yahoo.com
Guest
Posts: n/a
 
      23rd Aug 2006
Hi All,

I am lil confused with different ways of asynchronous data access.

My understanding is that, asynchronous data access frees up a thread
instead of engaging it while a stored proc is being executed. This
makes more threads available. Is this correct or are there ay other
advantages of asynchronous data access?

My questions are:

1. I cannot set the async page directive to true as suggested in
some articles. I get an error saying incorrect page directive.

2. I can set async attribute in connection string as suggested in
few articles. I get error 'Keyword not supported.


Am I missing something to get the above errors or the articles I got
the above information from are outdated?

Here is my code. I made sense from 100 different sources before coding.
Would some one tell me if I am doing it correctly? I correctly see
deferent thread id's before and after data access.

Private Function getdata() As System.Data.SqlClient.SqlDataReader
Dim dr As System.Data.SqlClient.SqlDataReader

'code to run any sql get dr
If dr Is Nothing OrElse dr.IsClosed OrElse Not dr.HasRows Then
Return Nothing
Exit Function
End If
Return dr
End Function
Public Delegate Function AsyncDelegate() As
System.Data.SqlClient.SqlDataReader
Private Function getdataAsync() As
System.Data.SqlClient.SqlDataReader
Dim dlgt As New AsyncDelegate(AddressOf getdata)
Dim ar As IAsyncResult = dlgt.BeginInvoke(Nothing, Nothing)
'display(AppDomain.GetCurrentThreadId()) (this a thread)
Thread.Sleep(0)
Dim adr As System.Data.SqlClient.SqlDataReader =
dlgt.EndInvoke(ar)
'display(AppDomain.GetCurrentThreadId()) (this is a different
thread than the above.)
Return adr
End Function

I greatly appreciate any help.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read data from an asynchronous Socket Giulio Petrucci Microsoft C# .NET 2 28th Dec 2006 08:21 AM
Asynchronous data access in ASP.NET developer Microsoft Dot NET 3 24th Aug 2006 07:20 PM
Asynchronous data access in ASP.NET vpidatala@yahoo.com Microsoft VB .NET 0 24th Aug 2006 02:25 PM
Asynchronous Socket Server data =?Utf-8?B?TWFjY2E=?= Microsoft C# .NET 0 5th Apr 2006 03:58 PM
Asynchronous Data Access in ASP.NET (Live demo) Prodip Saha Microsoft ASP .NET 0 25th May 2005 04:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:38 PM.