Reputation: 43
I'm running Visual Studio 2008 and have been told that I have all rights to create #temp tables. I have done this before, but for some reason my sql in the new application always returns 0 rows.
I have the SQL connection string stored in my Application events as
Friend sqlConnProducts as String
I create a sql string and pass it to the SQLExecute Function
Private Function SQLExecute(ByVal sSQL As String) As DataTable
Dim rtnTable As New DataTable()
Dim sConn As New SqlConnection(My.Application.sqlConRecvInsp)
Dim sCmd As New SqlCommand(sSQL, sConn)
Dim taAdapter As New SqlDataAdapter(sCmd)
Try
sConn.Open()
sCmd.CommandTimeout = 0
taAdapter.Fill(rtnTable)
sConn.Close()
Catch ex As Exception
MessageBox.Show("SQL Failed at: " & ex.Message & vbNewLine & ex.StackTrace)
End Try
sConn.Dispose()
sCmd.Dispose()
Return rtnTable
End Function
I even have a debug.print(sql) in the sql creation phase. When I run the output from the debug, I get about 7k records. Any suggestions?
Upvotes: 0
Views: 155
Reputation: 24142
Here are some links that might light your path to your solution:
Finally, I doubt a temporary table i suitable for your needs here.
Upvotes: 1
Reputation: 50067
Take a look at the following regarding SQL Server temp tables - it may provide some guidance as to what's going on.
http://weblogs.sqlteam.com/mladenp/archive/2006/11/03/17197.aspx
Share and enjoy.
Upvotes: 1