slindee (28) [Avatar] Offline
I want to write a generalized pass-thru query where the SQL statement is passed to the LINQ function from the caller. What should the Dim query As .... be to make this work? Code below:
Public Shared Function ExecuteSQL(ByVal strModuleConnectionString As String, _
ByVal strSQL As String) As DataTable
Dim dt As New DataTable
Dim dc As New dcModuleDataContext(strModuleConnectionString)
Dim query As System.Linq.IOrderedQueryable
query = dc.ExecuteQuery(strSQL)
dt = query.CopyToDataTable
Catch exc As Exception
Call WinExcept.ExceptionHandler.Exception(clinqModule, exc)
dt = Nothing
End Try
Return dt
End Function