473,785 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Sql Client.SqlDataR eader
Dim dr As System.Data.Sql Client.SqlDataR eader
'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.Sql Client.SqlDataR eader
Private Function getdataAsync() As
System.Data.Sql Client.SqlDataR eader
Dim dlgt As New AsyncDelegate(A ddressOf getdata)
Dim ar As IAsyncResult = dlgt.BeginInvok e(Nothing, Nothing)
'display(AppDom ain.GetCurrentT hreadId()) (this a thread)
Thread.Sleep(0)
Dim adr As System.Data.Sql Client.SqlDataR eader =
dlgt.EndInvoke( ar)
'display(AppDom ain.GetCurrentT hreadId()) (this is a different
thread than the above.)
Return adr
End Function
I greatly appreciate any help

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

--
Patrice

"developer" <vp*******@yaho o.coma écrit dans le message de news:
11************* ********@h48g20 00...legro ups.com...
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.Sql Client.SqlDataR eader
Dim dr As System.Data.Sql Client.SqlDataR eader
'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.Sql Client.SqlDataR eader
Private Function getdataAsync() As
System.Data.Sql Client.SqlDataR eader
Dim dlgt As New AsyncDelegate(A ddressOf getdata)
Dim ar As IAsyncResult = dlgt.BeginInvok e(Nothing, Nothing)
'display(AppDom ain.GetCurrentT hreadId()) (this a thread)
Thread.Sleep(0)
Dim adr As System.Data.Sql Client.SqlDataR eader =
dlgt.EndInvoke( ar)
'display(AppDom ain.GetCurrentT hreadId()) (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*******@yaho o.coma écrit dans le message de news:
11************* ********@h48g20 00...legro ups.com...
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.Sql Client.SqlDataR eader
Dim dr As System.Data.Sql Client.SqlDataR eader
'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.Sql Client.SqlDataR eader
Private Function getdataAsync() As
System.Data.Sql Client.SqlDataR eader
Dim dlgt As New AsyncDelegate(A ddressOf getdata)
Dim ar As IAsyncResult = dlgt.BeginInvok e(Nothing, Nothing)
'display(AppDom ain.GetCurrentT hreadId()) (this a thread)
Thread.Sleep(0)
Dim adr As System.Data.Sql Client.SqlDataR eader =
dlgt.EndInvoke( ar)
'display(AppDom ain.GetCurrentT hreadId()) (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*******@yaho o.coma écrit dans le message de news:
11************* *********@h48g2 00...legr oups.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*******@yaho o.coma écrit dans le message de news:
11************* ********@h48g20 00...legro ups.com...
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.Sql Client.SqlDataR eader
Dim dr As System.Data.Sql Client.SqlDataR eader
'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.Sql Client.SqlDataR eader
Private Function getdataAsync() As
System.Data.Sql Client.SqlDataR eader
Dim dlgt As New AsyncDelegate(A ddressOf getdata)
Dim ar As IAsyncResult = dlgt.BeginInvok e(Nothing, Nothing)
'display(AppDom ain.GetCurrentT hreadId()) (this a thread)
Thread.Sleep(0)
Dim adr As System.Data.Sql Client.SqlDataR eader =
dlgt.EndInvoke( ar)
'display(AppDom ain.GetCurrentT hreadId()) (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
8676
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 trying to decide if I should use remoting vs. writing a server that uses networkstreams. I have read that networkstreams\tcp programming should be faster than remoting and is a better choice for what I am doing but that it is difficult to code.
1
2841
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 remote server and display this info on the UI. From doing some research, I know that the way my implementation works today is not thread-safe, because essentially my worker thread updates the UI, which is BAD. So, here I am trying to figure out how...
0
1146
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 increasingly popular everyday as the technology is moving towards the service oriented architecture(SOA). Part of my job is to present shared volume of data to the user interface like web form. Depending on the requests sometime it takes only fraction of...
2
2187
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 it back to the SAME socket - the data isnt a large value (measured in bytes rather than MB or GB) i TRIED thinking of this in the Asynchronous way - BeginReceive - then pass to the OnClient Connected handler, which calls a Wait For Data
7
9716
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 for this being to stop the user thinking the application has frozen when in fact it is just waiting for a long SP to complete. Another reason for doing it like this is that I also have had a problem in the past where the SP takes longer than the...
1
2879
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 website? This question is wide open but make sure you give me some ideas in context with DAAB syntax. Some thoughts are threading, ATLAS, etc. but I have no clue how to even approach an Asynchronous Insert or any techniques at this point. Also, I...
8
1736
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 in to our website, we implement a single login for multiple services (let's call them services A-D). This means, that on the backend, while sampleuser logs in to our service with only one username and password, he is automatically logged in to...
0
1025
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 being executed. This makes more threads available. Is this correct or are there ay other advantages of asynchronous data access? My questions are:
0
1757
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 ------------------------------------------------------------------------------------------------------------------------- My web.config file: ---------------------
10
5850
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 rebuilding my company's Access 97 VBA database app. It pulls 115,000 items (of account names) from SqlServer and the data is bound to a single Access 97 ComboBox control. My C# version needs to work exactly like this one. Our executive employees want...
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10097
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9957
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8983
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.