Solved

Timeout expired useing vb.net with sql 2005

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

630 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