Timeout Expired

A

Agnes

I am using vb.net to process a SP
The sp are insert XXX select () statment, there are two parameters , Start
Company code and End Company Code,
The user input the range From A to Z or From A to B.
I found that If the range is A to C , the SP runs fine , if the range is A
to Z , I will got Timeout Expired error,
If I run the SP in SQL analyzer, everyting go fines.
Does the error belong to vb.net ?

Dim cmd As New SqlClient.SqlCommand
cmd.Connection = conSea
cmd.CommandText = "dbo.sel_cs_company"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New SqlParameter("@reportid",
SqlDbType.VarChar, 20)).Value = Me.pReportId

cmd.ExecuteNonQuery()
cmd.Parameters.Clear()
cmd.Dispose()
 
A

Agnes

I just set commandTimeout = 0 , and there is no error anymore

--
..
Cor Ligthert said:
Agnes,

In this code is not much VBNet except that you uses "dim" furter it is exact
the same as C# without row end stuff.

You can use the
cmd.CommandTimeout = 160

However when it stays I would ask it in the newsgroup
Adonet
news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet

Web interface:
http://communities2.microsoft.com/c.../?dg=microsoft.public.dotnet.framework.adonet

I hope this helps?

Cor
 
C

Cor Ligthert

Agnes,

Than you can probably as well delete your database without that you get an
error.
From the page about that property

A value of 0 indicates no limit, and should be avoided in a CommandTimeout
because an attempt to execute a command will wait indefinitely.

I hope this helps?

Cor

Agnes said:
I just set commandTimeout = 0 , and there is no error anymore

--
.
Cor Ligthert said:
Agnes,

In this code is not much VBNet except that you uses "dim" furter it is exact
the same as C# without row end stuff.

You can use the
cmd.CommandTimeout = 160

However when it stays I would ask it in the newsgroup
Adonet
news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet

Web interface:
http://communities2.microsoft.com/c.../?dg=microsoft.public.dotnet.framework.adonet

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top