473,385 Members | 1,843 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,385 software developers and data experts.

Need help with slow ExecuteNonQuery in C# Application

2
hi, i am currently writting a C# windows service that is time critical.

As a breif introduction, the application receives messages from a source, from that message, it is passed in a thread from the thread pool.

Here the message is decrypted, and has some processing done to it.

Once the processing is done the data is stored into a MS SQL 2005 Database using a stored proc, the whole process takes about 350 milliseconds, which is not accectable from my point of view. I would like it to take appox 100 milliseconds.

If i remove the line

dbQuery.ExecuteNonQuery();

it only takes about 80 - 100 milliseconds which would be great.

The connection is created, not reused, just before the execution but doesnt seem to slow the process.

is there any way of making this process faster, or is there any links i can use for Stored Procedure optimization?

and other ideas would be awesome as well.

Cheers
Aug 10 '07 #1
5 8289
TRScheel
638 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. dbQuery.ExecuteNonQuery();
tells your SQL server to run the commands. Depending on what its doing and to how many values will determine how long this line takes.
Aug 10 '07 #2
kenobewan
4,871 Expert 4TB
Databases respond faster when the stored procedure is simpler or shorter - they like be 'chatty' - so multiple simple queries make for a faster application.
Aug 10 '07 #3
TRScheel
638 Expert 512MB
..they like be 'chatty'..
Is that the technical term? hehe
Aug 10 '07 #4
Is that the technical term? hehe
Beyond good old fashioned query optimization, you can minimize your sql compile time by using a stored proc or parameterized query (http://www.codeproject.com/cs/database/ParameterizingAdHocSQL.asp). If you're making the call inside a loop, use the Prepare() method before entering the loop to reduce "chattiness" (too much data going across the wire).
Aug 10 '07 #5
doiley
2
thanks for that, i made some changes to the stored proc and i got the times i was looking for
Aug 10 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
1
by: Matthew Louden | last post by:
I just tried to create a simple ASP.NET application to add record to the SQL Server database. However, it has run time error on Line 88: objCommand.ExecuteNonQuery() Any ideas?? Please help!!...
0
by: johnnymack0730 | last post by:
Hello - I am currently working on an asp.net application that needs to be able to update an access table using ExecuteNonQuery method. I have all the code setup, it runs, there are no errors...
3
by: Jack Black | last post by:
Help!! I'm trying to call a custom stored procedure from a VB.Net code-behind page in an ASP.Net application, and I keep getting an error with no real helpful info... Basically, I'm accepting a...
3
by: Benny Ng | last post by:
Dear all, The following is the source. The password is encrypted and saved into the Binary in SQL2K. Now I want to create a new page to compare the existed password and the password that in the...
1
by: Adam Flint | last post by:
I have a .NET application (actually MCMS, but I think that's irrelevant) that access a SQL Server database using Microsoft Data Access Blocks (DAB). Consider the following pseudo-code: For...
3
by: david | last post by:
I have trouble with it. I have created a sproc in SQL Server, called SearchClass, which returns a searched key from a table. I have tested this procedure in Analyzer and it works fine. However,...
5
by: Matt | last post by:
Hi all, I'm trying to use the following code in an application: // retrieve the connection string string strDbcx = Globals.strDbcx; // create the connection OleDbConnection dbcx = new...
1
by: teddymeu | last post by:
Hi Guys, trying to bulk insert a csv file into my SQL database from an asp.net vb web app/form page that the user uploads, my problem is that im new to all this and although the SQL statement...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.