Runs the specified SQL query.
| Visual Basic |
|---|
Public Sub ExecuteQuery( _
   ByVal Query As String _
) |
- Query
A SQL query
The system does not validate the SQL.
If the query result is empty, the DataTable.Rows.Count property is set to 1.
To query a user-defined table, put the table name within square brackets. This is because the @ symbol before the table name is a reserved symbol in SQL Server. For example:
DataTable.ExecuteQuery "select * from [@usertablename]"
| Executing a query (Visual Basic) | Copy Code | |
|---|---|---|
| ||