<connection>.Execute query
Set <recordset> = <connection>.Execute(query)
Name | Type | Description | Required |
---|---|---|---|
query | string or ADODB.Command object | String containing an SQL query to be executed against the database or an ADODB.Command object to execute. | Yes |
This method executes a specified SQL query against the database connection.
The first syntax shown above is used when the query will not return a recordset (e.g. INSERT/UPDATE/DELETE queries). The second syntax is used when the query will return a recordset object (e.g. SELECT query).
Dim rsGroups Dim strGroups Dim SQL strGroups = "" SQL = "SELECT group_name FROM group_users gu LEFT JOIN groups g ON gu.group_id = g.group_id "&_ "WHERE gu.user_id = " & DBConnection1.ToSQL(CCGetUserID(),ccsInteger) Set rsGroups = DBConnection1.Execute(SQL) While rsGroups.EOF strGroups = IIf(strGroups = "", rsGroups("group_name"), ", " & rsGroups("group_name")) rsGroups.MoveNext Wend UserProfile.UserGroups.Value = strGroups