Hai
can someone suggest me what is the problem with my code?
1. Actually i keep getting the error:
Runtime error '2147217871 (80040e31)' Timeout Expired.
I am using "cnPubs.ConnectionTimeout = 0"
this command in my code so it should not give me a
timeout error.But i keep getting the error.
There are many joins in my stored procedure and the data
is huge,,lakhs of records..Is the error because of the
huge data???? i dont understand.
My procedure is as follows..I am using this procedure
Sub DataExtract()
Dim cnPubs As ADODB.Connection
Set cnPubs = New ADODB.Connection
cnPubs.ConnectionTimeout = 0
Dim strConn As String
strConn = "PROVIDER=SQLOLEDB;"
strConn = strConn & "DATA SOURCE=(PRODUCTXP);INITIAL
CATALOG=PROREPORTING;"
'strConn = strConn & "DATA SOURCE=(local);INITIAL
CATALOG=LTFG;"
strConn = strConn & " INTEGRATED SECURITY=sspi;"
cnPubs.Open strConn
cnPubs.ConnectionTimeout = 0
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = cnPubs
cmd.CommandText = "PRO_SP"
cmd.CommandType = adCmdStoredProc
cmd.Execute
cnPubs.Close
Set cnPubs = Nothing
End Sub
The stored procedure runs for about 3 minutes.
2. How do i import this data to excel sheet? Actually
this code is in visual basic editor of the excel sheet.
how do i dump the data to the excel sheet??
Thanks in advance for any help
Vamsi