SQL Call From Code Not Working

  • Thread starter Thread starter old_School
  • Start date Start date
O

old_School

Guest
I'm not sure why this is not returning any data:


Public Function Execute_SQL(query As String) As DataTable
Dim command As New SqlCommand
Dim dt As New DataTable
Dim da As New SqlDataAdapter(command)

Try
_cnn = New SqlConnection(_con)
command = _cnn.CreateCommand()
_cnn.Open()
command.CommandText = query
da.Fill(dt)

Catch ex As Exception
'No rows
End Try

_cnn.Close()
Return dt
End Function


When I run my query in SQL I get a row returned

SELECT fileurl,IsError,IsQueued, * FROM FILES WHERE fileid IN ('111791')


What did I do wrong here? Sorry Vb code did not mean to post this in c# forums

Continue reading...
 
Back
Top