Home All Groups Group Topic Archive Search About
Author
19 Apr 2006 1:11 PM
Lou Civitella
I am setting the source of a crystal report and sometimes get a Timeout
error.
How can I increase the timeout?
It seems to timeout after 30 seconds.

Here is a snippet of the code that I use.
Using VB 2005

Dim oRpt As New ReportDocument
Dim strConnectionString As String = "Data Source=Server1;Initial
Catalog=Database1;Persist Security Info=True;User ID=test;Password=password"
Dim conn As New SqlConnection(strConnectionString)
Dim strSQL as String = "SELECT * FROM Table1"

Dim DS As New Data.DataSet
Dim DA As New SqlDataAdapter(strSQL, conn)

DA.Fill(DS)

oRpt.Load(Application.StartupPath.ToString &
"\Reports\pc_detail_employee.rpt")
oRpt.SetDataSource(DS.Tables(0))

Thanks,
Lou

Author
19 Apr 2006 2:24 PM
Marina Levit [MVP]
Before the fill, do:

DA.SelectCommand.CommandTimeout = ??

Replace the '??' with whatever value you feel is appropriate. You can use 0
for an infinite timeout.

Show quote
"Lou Civitella" <l**@webersystems.com> wrote in message
news:%23Fjd5K7YGHA.2376@TK2MSFTNGP03.phx.gbl...
>I am setting the source of a crystal report and sometimes get a Timeout
>error.
> How can I increase the timeout?
> It seems to timeout after 30 seconds.
>
> Here is a snippet of the code that I use.
> Using VB 2005
>
> Dim oRpt As New ReportDocument
> Dim strConnectionString As String = "Data Source=Server1;Initial
> Catalog=Database1;Persist Security Info=True;User
> ID=test;Password=password"
> Dim conn As New SqlConnection(strConnectionString)
> Dim strSQL as String = "SELECT * FROM Table1"
>
> Dim DS As New Data.DataSet
> Dim DA As New SqlDataAdapter(strSQL, conn)
>
> DA.Fill(DS)
>
> oRpt.Load(Application.StartupPath.ToString &
> "\Reports\pc_detail_employee.rpt")
> oRpt.SetDataSource(DS.Tables(0))
>
> Thanks,
> Lou
>
Author
19 Apr 2006 2:28 PM
W.G. Ryan - MVP
Add Connection Timeout = Whatever at the end of the connection string.
Show quote
"Lou Civitella" <l**@webersystems.com> wrote in message
news:%23Fjd5K7YGHA.2376@TK2MSFTNGP03.phx.gbl...
>I am setting the source of a crystal report and sometimes get a Timeout
>error.
> How can I increase the timeout?
> It seems to timeout after 30 seconds.
>
> Here is a snippet of the code that I use.
> Using VB 2005
>
> Dim oRpt As New ReportDocument
> Dim strConnectionString As String = "Data Source=Server1;Initial
> Catalog=Database1;Persist Security Info=True;User
> ID=test;Password=password"
> Dim conn As New SqlConnection(strConnectionString)
> Dim strSQL as String = "SELECT * FROM Table1"
>
> Dim DS As New Data.DataSet
> Dim DA As New SqlDataAdapter(strSQL, conn)
>
> DA.Fill(DS)
>
> oRpt.Load(Application.StartupPath.ToString &
> "\Reports\pc_detail_employee.rpt")
> oRpt.SetDataSource(DS.Tables(0))
>
> Thanks,
> Lou
>
Author
19 Apr 2006 2:34 PM
Cor Ligthert [MVP]
> Add Connection Timeout = Whatever at the end of the connection string.

As long as it is a value and more than 0 'or you would like rusian roulette

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectiontimeout.aspx

Cor

AddThis Social Bookmark Button