I'm having the same problem but I'm trying to edit someone elses code. Can anyone help me with this? Where would I set the connection timeout to 0 in the function below?
Thanks...
Private Function Data2Array() As Array
Try
If (dbConnection.State = ConnectionState.Closed) Then dbConnection.Open()
'select count(*) from TimesheetStudentActions where stuAction='feedback'
Dim dTable As New DataTable("temp")
Dim dtAdapter As New SqlDataAdapter("SELECT SECTIONID,SCHLSTUID,convert(varchar(10),cast(DAYACCESSED as dateTime),101), " & _
" ACTIONID, DATEPART(ww,convert(varchar(10),cast(DAYACCESSED as dateTime),101)) WeekOfYear, " & _
" DATEPART(dw,convert(varchar(10),cast(DAYACCESSED as dateTime),101)) DayOfWeek FROM " & _
" TimesheetStudentActions WHERE stuAction <> 'feedback' AND IsNull(ynPROCESSED,0) = 0 AND SCHLSTUID IN (SELECT SCHLSTUID From TimesheetStudent)", dbConnection)
dtAdapter.Fill(dTable)
Dim intArraycounterMax As Integer = dTable.Rows.Count - 1
Dim intFieldcounterMax As Integer = dTable.Columns.Count - 1
Dim intFieldcounter As Integer
Dim MyArray(intArraycounterMax, intFieldcounterMax) As String
Dim intarraycounter As Integer = 0
Dim dRow As DataRow
For Each dRow In dTable.Rows
For intFieldcounter = 0 To intFieldcounterMax
Try
MyArray(intarraycounter, intFieldcounter) = dRow(intFieldcounter)
Catch ex1 As InvalidCastException
' Nothing to do Nulls are ok
Finally
End Try
Next
intarraycounter += 1
Next
Return (MyArray)
Catch ex As Exception
WriteToLogFile("Exception: " + ex.Message + ex.StackTrace, sImportErrorFile)
Finally
If Not (dbConnection Is Nothing) Then
If (dbConnection.State = ConnectionState.Open) Then
dbConnection.Close()
End If
End If
End Try
End Function