Solved

Timeout expired useing vb.net with sql 2005

Posted on 2008-06-16
4
1,374 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

680 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