Solved

Timeout expired useing vb.net with sql 2005

Posted on 2008-06-16
4
1,372 Views
Last Modified: 2013-11-26
Hi,
 experts,

I am execute store proce. thru vb.net i geting error Timeout expired

store procedur has 155 line

        cn = New SqlClient.SqlConnection(STR01)

        If cn.State = ConnectionState.Closed Then
            cn.Open()
        Else
            cn.Close()
            cn.Open()
        End If
        'cm.CommandTimeout = 1800
        cm = New SqlClient.SqlCommand(str1, cn)
        cm.CommandType = CommandType.StoredProcedure
        Dim para As SqlClient.SqlParameter
        para = cm.Parameters.Add("@Path", SqlDbType.NVarChar, 250)
        para.Value = TextBox1.Text

        para = cm.Parameters.Add("@Type", SqlDbType.NVarChar, 4)
        para.Value = "Full"
        CommExesp = cm.ExecuteNonQuery()
        Return CommExesp
        Exit Function
0
Comment
Question by:JAYANSPX
  • 3
4 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 21792406
If you run your stored procedure on sql-server, how long does it take than to execute ?
0
 

Author Comment

by:JAYANSPX
ID: 21792459

i run stored prodcedure on sql-server it's take 42 sec.

i am setting  timeout

cm.CommandTimeout = 1800

but still i geting that erro
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 250 total points
ID: 21792623
Do you have this in your stored procedure ?
SET NOCOUNT ON
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 21792641
This didn't solve it ?
cm = New SqlClient.SqlCommand(str1, cn)
cm.CommandTimeout = 2000

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 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