Solved

Timeout expired useing vb.net with sql 2005

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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