Essentially all you need to do is pass a SQL statement to the server. With SQL Server it would be something like. Not sure what you're using, but it should be similar.. just with some different connection/command objects.
Dim sqlCnn As SqlConnection
Dim sqlCmd As SqlCommand
sqlCnn = New SqlConnection(<connection_string>)
sqlCmd = New SqlCommand(<sql_statement>, sqlCnn)
sqlCmd.Connection = sqlCnn
sqlCmd.CommandText = inSQL
sqlCmd = Nothing