473,387 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Asynchronous data access in ASP.NET

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

Aug 24 '06 #1
3 2990
This is new in 2.0. Are you using 2.0 or 1.1 ?

--
Patrice

"developer" <vp*******@yahoo.coma écrit dans le message de news:
11*********************@h48g2000cwc.googlegroups.c om...
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

Aug 24 '06 #2
I have 2.0 installed. I think 2.0 is being used to execute the code I
gave, Or else I will get an error executing it, right?
Patrice wrote:
This is new in 2.0. Are you using 2.0 or 1.1 ?

--
Patrice

"developer" <vp*******@yahoo.coma écrit dans le message de news:
11*********************@h48g2000cwc.googlegroups.c om...
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
Aug 24 '06 #3
Do you use other features from 2.0 that are working ? Have you checked that
your site uses 2.0 (you have a tab in the IIS console that allows to select
which version the site uses).

For now I 'm suspicious as the async directive doesn't seems to be
recognized. The exact error message could help. If this something else if
you write at the same place a directive name that for sure doesn't exists ?

--
Patrice

"developer" <vp*******@yahoo.coma écrit dans le message de news:
11**********************@h48g2000cwc.googlegroups. com...
I have 2.0 installed. I think 2.0 is being used to execute the code I
gave, Or else I will get an error executing it, right?
Patrice wrote:
This is new in 2.0. Are you using 2.0 or 1.1 ?

--
Patrice

"developer" <vp*******@yahoo.coma écrit dans le message de news:
11*********************@h48g2000cwc.googlegroups.c om...
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

Aug 24 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Michael Lindsey | last post by:
I need to write a server app to send images to client GUIs that are outside of the server's domain. The client will have the file system path to the image but can not access the file system. I am...
1
by: Natalia DeBow | last post by:
Hi, I am working on a Windows-based client-server application. I am involved in the development of the remote client modules. I am using asynchronous delegates to obtain information from...
0
by: Prodip Saha | last post by:
http://www.aspnet4you.com/Articles.aspx?ArticleID=5017 Asynchronous Data Access in ASP.NET (Live demo) Author: Saha,Prodip Posted:5/15/2005 6:03:17 PM Web Architecture is becoming...
2
by: Ronodev.Sen | last post by:
the way my program needs to go is -- 1) open a socket and listen on it 2) moment a client connects to the socket - process some data (by sending it to another machine), get the result and send...
7
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
1
by: dba123 | last post by:
I need to perform Asynchronous Inserts using DAAB. So far I have a method which does an insert but how can I do this Asyncronously so that it does not affect the load on our public production...
8
by: Simon Gorski | last post by:
I have a large problem, and I believe there is not yet a way to solve this using IIS and ASP.NET. I hope someone has a solution which we couldn't find. The current situation When a user logs...
0
by: vpidatala | last post by:
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...
0
by: Bishoy George | last post by:
Hi, I have a asp.net 2.0 web application. I want to implement the asynchronous model through http handler in web.config ...
10
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi, Problem: How can I databind (or put) a SqlServer query's row return of 115,000 items into a ComboBox quickly? Not much longer than a matter of seconds, that is... Scenario: I am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.