- Метод Execute (объект Command ADO) Execute Method (ADO Command)
- Синтаксис Syntax
- Возвращаемое значение Return Value
- Параметры Parameters
- Remarks Remarks
- Routed Command. Execute(Object, IInputElement) Метод
- Определение
- Параметры
- Исключения
- Примеры
- Комментарии
- Document.execCommand()
- Deprecated
- Syntax
- Return value
- Parameters
- Commands
- » .) forwardDelete Deletes the character ahead of the cursor’s position, identical to hitting the Delete key on a Windows keyboard. heading Adds a heading element around a selection or insertion point line. Requires the tag-name string as a value argument (i.e. «H1» , «H6» ). (Not supported by Internet Explorer and Safari.) hiliteColor Changes the background color for the selection or at the insertion point. Requires a color value string as a value argument. useCSS must be true for this to function. (Not supported by Internet Explorer.) increaseFontSize Adds a tag around the selection or at the insertion point. (Not supported by Internet Explorer.) indent Indents the line containing the selection or insertion point. In Firefox, if the selection spans multiple lines at different levels of indentation, only the least indented lines in the selection will be indented. insertBrOnReturn Controls whether the Enter key inserts a element, or splits the current block element into two. (Not supported by Internet Explorer.) insertHorizontalRule Inserts a element at the insertion point, or replaces the selection with it. insertHTML Inserts an HTML string at the insertion point (deletes selection). Requires a valid HTML string as a value argument. (Not supported by Internet Explorer.) insertImage Inserts an image at the insertion point (deletes selection). Requires a URL string for the image’s src as a value argument. The requirements for this string are the same as createLink . insertOrderedList Creates a numbered ordered list for the selection or at the insertion point. insertUnorderedList Creates a bulleted unordered list for the selection or at the insertion point. insertParagraph Inserts a paragraph around the selection or the current line. (Internet Explorer inserts a paragraph at the insertion point and deletes the selection.) insertText Inserts the given plain text at the insertion point (deletes selection). italic Toggles italics on/off for the selection or at the insertion point. (Internet Explorer uses the element instead of .) justifyCenter Centers the selection or insertion point. justifyFull Justifies the selection or insertion point. justifyLeft Justifies the selection or insertion point to the left. justifyRight Right-justifies the selection or the insertion point. outdent Outdents the line containing the selection or insertion point. paste Pastes the clipboard contents at the insertion point (replaces current selection). Disabled for web content. redo Redoes the previous undo command. removeFormat Removes all formatting from the current selection. selectAll Selects all of the content of the editable region. strikeThrough Toggles strikethrough on/off for the selection or at the insertion point. subscript Toggles subscript on/off for the selection or at the insertion point. superscript Toggles superscript on/off for the selection or at the insertion point. underline Toggles underline on/off for the selection or at the insertion point. undo Undoes the last executed command. unlink Removes the anchor element from a selected hyperlink. useCSS This deprecated API should no longer be used, but will probably still work.
Метод Execute (объект Command ADO) Execute Method (ADO Command)
Выполняет запрос, инструкцию SQL или хранимую процедуру, указанную в свойстве CommandText или CommandStream объекта Command. Executes the query, SQL statement, or stored procedure specified in the CommandText or CommandStream property of the Command object.
Синтаксис Syntax
Возвращаемое значение Return Value
Возвращает ссылку на объект набора записей , поток или ничего. Returns a Recordset object reference, a stream, or Nothing.
Параметры Parameters
RecordsAffected RecordsAffected
Необязательный элемент. Optional. Длинная переменная, к которой поставщик возвращает количество записей, затронутых операцией. A Long variable to which the provider returns the number of records that the operation affected. Параметр рекордсаффектед применяется только для запросов действий или хранимых процедур. The RecordsAffected parameter applies only for action queries or stored procedures. Рекордсаффектед не возвращает число записей, возвращенных запросом, возвращающим результат, или хранимой процедурой. RecordsAffected does not return the number of records returned by a result-returning query or stored procedure. Чтобы получить эти сведения, используйте свойство RecordCount . To obtain this information, use the RecordCount property. Метод EXECUTE не возвращает правильные сведения при использовании с адасинцексекуте, просто потому, что при асинхронном выполнении команды число затронутых записей может еще не быть известно во время возврата метода. The Execute method will not return the correct information when used with adAsyncExecute, simply because when a command is executed asynchronously, the number of records affected may not yet be known at the time the method returns.
Параметры Parameters
Необязательный элемент. Optional. Массив вариантов значений параметров, используемых в сочетании со входной строкой или потоком, указанным в параметре CommandText или CommandStream. A Variant array of parameter values used in conjunction with the input string or stream specified in CommandText or CommandStream. (Выходные параметры не будут возвращать правильные значения при передаче в этом аргументе.) (Output parameters will not return correct values when passed in this argument.)
Параметры Options
Необязательный элемент. Optional. Значение типа Long , указывающее, как поставщик должен оценивать свойство CommandText или CommandStream объекта Command . A Long value that indicates how the provider should evaluate the CommandText or the CommandStream property of the Command object. Может быть значением битовой маски, сделанным с помощью значений коммандтипинум и/или ексекутеоптионенум . Can be a bitmask value made using CommandTypeEnum and/or ExecuteOptionEnum values. Например, можно использовать адкмдтекст и адексекутенорекордс в сочетании, если предполагается, что ADO вычисляет значение свойства CommandText как текст и указывает, что команда должна быть удалена и не возвращать записи, которые могут быть созданы при выполнении текста команды. For example, you could use adCmdText and adExecuteNoRecords in combination if you want to have ADO evaluate the value of the CommandText property as text, and indicate that the command should discard and not return any records that might be generated when the command text executes.
Используйте значение Ексекутеоптионенум адексекутенорекордс для повышения производительности за счет минимизации внутренней обработки. Use the ExecuteOptionEnum value adExecuteNoRecords to improve performance by minimizing internal processing. Если указан параметр адексекутестреам , параметры адасинкфетч и адасинчфетчнонблоккинг игнорируются. If adExecuteStream was specified, the options adAsyncFetch and adAsynchFetchNonBlocking are ignored. Не используйте значения коммандтипинум для адкмдфиле или адкмдтабледирект с EXECUTE. Do not use the CommandTypeEnum values of adCmdFile or adCmdTableDirect with Execute. Эти значения можно использовать только в качестве параметров с методами Open и Requery набора записей. These values can only be used as options with the Open and Requery methods of a Recordset.
Remarks Remarks
При использовании метода EXECUTE для объекта Command выполняется запрос, указанный в свойстве CommandText или в свойстве CommandStream объекта. Using the Execute method on a Command object executes the query specified in the CommandText property or CommandStream property of the object.
Результаты возвращаются в наборе записей (по умолчанию) или в виде потока двоичных данных. Results are returned in a Recordset (by default) or as a stream of binary information. Чтобы получить двоичный поток, укажите адексекутестреам в параметрах, а затем укажите поток, задав команду. Properties («поток вывода»). To obtain a binary stream, specify adExecuteStream in Options, then supply a stream by setting Command.Properties(«Output Stream»). Для получения результатов можно указать объект потока ADO или указать другой объект потока, например объект ответа IIS. An ADO Stream object can be specified to receive the results, or another stream object such as the IIS Response object can be specified. Если перед вызовом EXECUTE с адексекутестреам не был указан поток, возникает ошибка. If no stream was specified before calling Execute with adExecuteStream, an error occurs. Расположение потока при возврате из EXECUTE зависит от конкретного поставщика. The position of the stream on return from Execute is provider specific.
Если команда не должна возвращать результаты (например, запрос SQL UPDATE), поставщик возвращает значение Nothing , если указан параметр адексекутенорекордс . в противном случае Execute возвращает закрытый набор записей. If the command is not intended to return results (for example, an SQL UPDATE query) the provider returns Nothing as long as the option adExecuteNoRecords is specified; otherwise Execute returns a closed Recordset. Некоторые языки приложений позволяют игнорировать это возвращаемое значение, если набор записей не требуется. Some application languages allow you to ignore this return value if no Recordset is desired.
EXECUTE выдает ошибку, если пользователь указывает значение для CommandStream , если CommandType — адкмдсторедпрок, адкмдтабле или адкмдтабледирект. Execute raises an error if the user specifies a value for CommandStream when the CommandType is adCmdStoredProc, adCmdTable, or adCmdTableDirect.
Если запрос содержит параметры, используются текущие значения параметров командного объекта, если только они не переопределены значениями параметров, передаваемыми при вызове EXECUTE . If the query has parameters, the current values for the Command object’s parameters are used unless you override these with parameter values passed with the Execute call. Можно переопределить подмножество параметров, опустив новые значения для некоторых параметров при вызове метода EXECUTE . You can override a subset of the parameters by omitting new values for some of the parameters when calling the Execute method. Порядок, в котором указываются параметры, совпадает с порядком, в котором метод передает их. The order in which you specify the parameters is the same order in which the method passes them. Например, при наличии четырех (или более) параметров и необходимости передачи новых значений только для первого и четвертого параметров необходимо передать в Array(var1. var4) качестве аргумента параметров . For example, if there were four (or more) parameters and you wanted to pass new values for only the first and fourth parameters, you would pass Array(var1. var4) as the Parameters argument.
Выходные параметры не будут возвращать правильные значения при передаче в аргумент параметров . Output parameters will not return correct values when passed in the Parameters argument.
Когда эта операция завершается, будет выдано событие ексекутекомплете . An ExecuteComplete event will be issued when this operation concludes.
При выдаче команд, содержащих URL-адреса, при использовании схемы HTTP автоматически вызывается поставщик Microsoft OLE DB для публикации в Интернете. When issuing commands containing URLs, those using the http scheme will automatically invoke the Microsoft OLE DB Provider for Internet Publishing. Дополнительные сведения см. в разделе абсолютные и относительные URL-адреса. For more information, see Absolute and Relative URLs.
Routed Command. Execute(Object, IInputElement) Метод
Определение
Выполняет RoutedCommand для текущего целевого объекта команды. Executes the RoutedCommand on the current command target.
Параметры
Пользовательский параметр, передаваемый данному обработчику. User defined parameter to be passed to the handler.
Элемент, для которого следует начать поиск обработчиков команд. Element at which to begin looking for command handlers.
Исключения
Параметр target не является объектом UIElement или ContentElement. target is not a UIElement or ContentElement.
Примеры
Следующий пример относится к пользовательской реализации ICommandSource примера. The following example is from a custom implementation of ICommandSource sample.
this.Command в этом примере это свойство Command для ICommandSource . this.Command in this example is the Command property on the ICommandSource. Если команда не имеет значение null, команда приводится к типу RoutedCommand . If the command is not null, the command is cast to a RoutedCommand. Если это, то RoutedCommand Execute метод называется передачей CommandTarget и CommandParameter . If it is a RoutedCommand, then the Execute method is called passing the CommandTarget and the CommandParameter. Если команда не является RoutedCommand , она приводится к типу, ICommand а Execute метод называется передачей CommandParameter . If the command is not a RoutedCommand, it is cast to an ICommand and the Execute method is called passing the CommandParameter.
Комментарии
Фактическая логика, которая выполняет, RoutedCommand не содержится в Execute методах. The actual logic that executes the RoutedCommand is not contained in the Execute methods. Execute вызывает PreviewExecuted события и Executed , которые проходят и пузырьковые по дереву элементов ищут объект с CommandBinding . Execute raises the PreviewExecuted and Executed events, which tunnel and bubble through the element tree looking for an object with a CommandBinding. Если CommandBinding RoutedCommand найден, то ExecutedRoutedEventHandler вызывается метод, присоединенный к CommandBinding . If a CommandBinding for that RoutedCommand is found, then the ExecutedRoutedEventHandler attached to CommandBinding is called. Эти обработчики предоставляют логику программирования, которая выполняет RoutedCommand . These handlers supply the programming logic that performs the RoutedCommand.
PreviewExecutedСобытия и Executed вызываются в CommandTarget . The PreviewExecuted and Executed events are raised on the CommandTarget. Если параметр CommandTarget не задан для ICommandSource , PreviewExecuted Executed события и вызываются для элемента с фокусом клавиатуры. If the CommandTarget is not set on the ICommandSource, the PreviewExecuted and Executed events are raised on the element with keyboard focus.
Document.execCommand()
Deprecated
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
When an HTML document has been switched to designMode , its document object exposes an execCommand method to run commands that manipulate the current editable region, such as form inputs or contentEditable elements.
Most commands affect the document’s selection (bold, italics, etc.), while others insert new elements (adding a link), or affect an entire line (indenting). When using contentEditable , execCommand() affects the currently active editable element.
Syntax
Return value
A Boolean that is false if the command is unsupported or disabled.
Note: document .execCommand() only returns true if it is invoked as part of a user interaction. You can’t use it to verify browser support before calling a command. From Firefox 82, nested document.execCommand() calls will always return false .