I have a query that when run via sql server management studio, it takes 30 seconds. But when I run it within my source code to populate a DataTable, it errors with a timeout.
Here is my code that uses the query to populate the DataTable. It errors right after the Fill:
Public Function GetDataTable(ByVal sql As String) As DataTable
Dim con As New SqlConnection(Name.GetConnectionString)
Dim adapter As New SqlDataAdapter()
adapter.SelectCommand = New SqlCommand(sql, con)
Dim myDataTable As New DataTable()
Is there something wrong with my code above that would cause the same query that runs successfully in SSMS to fail with a web project? It goes straight to the Finally block.