[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Asynchronous send command to SQL Server with ADO.NET

Posted on 2009-07-01
7
Medium Priority
?
275 Views
Last Modified: 2013-12-17
Hi experts!

  Im using C# 2008 , WinForm NET 2, ADO.NET and SQL Server 2005 with connection model connection, reader and command. Im interesting what are my option to have Asynchronous execution to SQL Server ? I want to do this for not so important save to DB and to avoid user to wait for this end .

Asynchronous

 I have open 1 connection which is close only when I close program. Can I use this connection ?
0
Comment
Question by:dvplayltd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 24753195
0
 

Author Comment

by:dvplayltd
ID: 24754303
Thank you very much for you blog :-)

So look simple, if I do not interest when function will be end I simple call
mcmEmployees.BeginExecuteReader(Nothing, Nothing)

right ?

By the way, I do this due to slow internet. Record which I will save in this way are record for save user activites.
WHat is you option, is is good idea to use this  ?   I'm sure that for let say 0.5 sec. user can not do other action and for this time Asuncnosius operation will be ended. Even in case in 0.1 % of all record in which is not save this it is not so big problem, as long I do not have problem with other work.


Aaa. In call back I see that you close this command object . If I not have call back at all will I have problem if I not close this command ? For next operation same command will be created with New and I think that I will not have problem with this. What you will say ?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 24754567
>>If I not have call back at all will I have problem

How will you know that your command succeeded?
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:dvplayltd
ID: 24755277
I will not know ..but I do not need to know. Command will insert record and in 99.99 % will be OK, for other 0.01 % .. i do not care.
Reason to fail this record can be only 1 - connection is broken (this is possibe as my connection is via Interet to SQL Server) , and all other action wil stop at all, so with sure only 1 last user action will not be saved.

 I have second system for log which are independant from this for which I ask for, this is one more reason to not care for this 0.01 % in which I can not have record.

This save will be on every almost any user action like open form, close form (menu), commit specific action , search record .. too many cases to make user to wait for this. I want to make record for user action, but want to pay this hight price for this :-)

By the way .. i use MARS. Hyyym. With 3 user server show me that I have open 15 connection, I think that this is due to MARS. I'm interesting this MARS are count like separate connection, or not ? This question is connected with needed license about number connection to SQL Server.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 24755522
have a look at http://msdn.microsoft.com/en-us/library/ms379553(VS.80).aspx.

you should always handle the callback to close your command.

Licensing is very complex. There are so many variations. Do you have a site license or per processor license or a per seat license or ... ?

0
 

Author Comment

by:dvplayltd
ID: 24755803
My license will be per processor.
But I'm interesting if it was on CAL, than ??

Other - more importnat> I read deeply this new link from you, thank you.
Hyym. it say that connection thah have async=true take more time.

Execution of synchronous operations on connections that have asynchronous operations enabled will have noticeably increased resource utilization.

In cases where you need both synchronous and asynchronous APIs, you should use different connections if possible. If that's not an option, then you can still use the synchronous methods in connections opened with async=true, and they'll behave as usual; you'll see a small performance degradation, though.

Hyyym. How much slow will be all operation ? I think that will be minimal at I final I will have better perfonamce .. what is you option ?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 24755945
>>How much slow will be all operation ?

I don't know.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question