DbCommandBuilder.GetDeleteCommand Metodo
Definizione
Overload
GetDeleteCommand() |
Ottiene l'oggetto DbCommand generato automaticamente, richiesto per eseguire le operazioni di eliminazione nell'origine dati.Gets the automatically generated DbCommand object required to perform deletions at the data source. |
GetDeleteCommand(Boolean) |
Ottiene l'oggetto DbCommand generato automaticamente, richiesto per eseguire le operazioni di eliminazione nell'origine dati, eventualmente utilizzando le colonne per i nomi dei parametri.Gets the automatically generated DbCommand object required to perform deletions at the data source, optionally using columns for parameter names. |
Commenti
Un'applicazione può utilizzare il GetDeleteCommand metodo a scopo informativo o di risoluzione dei problemi perché restituisce l' DbCommand oggetto da eseguire.An application can use the GetDeleteCommand method for informational or troubleshooting purposes because it returns the DbCommand object to be executed.
È anche possibile usare GetDeleteCommand come base di un comando modificato.You can also use GetDeleteCommand as the basis of a modified command. Ad esempio, è possibile chiamare GetDeleteCommand e modificare il testo del comando associato e quindi impostarlo in modo esplicito su DbDataAdapter .For example, you might call GetDeleteCommand and modify the associated command text, and then explicitly set that on the DbDataAdapter.
Dopo che l'istruzione SQL viene generata per la prima volta, l'applicazione deve chiamare in modo esplicito RefreshSchema se modifica l'istruzione in qualsiasi modo.After the SQL statement is first generated, the application must explicitly call RefreshSchema if it changes the statement in any way. In caso contrario, GetDeleteCommand utilizzerà ancora le informazioni dell'istruzione precedente, che potrebbero non essere corrette.Otherwise, the GetDeleteCommand will still be using information from the previous statement, which might not be correct. Le istruzioni SQL vengono innanzitutto generate quando l'applicazione chiama Update o GetDeleteCommand .The SQL statements are first generated either when the application calls Update or GetDeleteCommand.
Il comportamento predefinito, quando si generano i nomi dei parametri, consiste nell'usare @p1
, @p2
e così via per i vari parametri.The default behavior, when generating parameter names, is to use @p1
, @p2
, and so on for the various parameters. Se la versione di overload di GetDeleteCommand consente di specificare questo comportamento fornendo un valore booleano, è possibile fare in modo che la DbCommandBuilder generazione di parametri in base ai nomi di colonna venga invece passata True
.If the overloaded version of GetDeleteCommand allows you to specify this behavior by supplying a Boolean value, you can cause the DbCommandBuilder to generate parameters based on the column names instead by passing True
.
GetDeleteCommand()
public:
System::Data::Common::DbCommand ^ GetDeleteCommand();
public System.Data.Common.DbCommand GetDeleteCommand ();
member this.GetDeleteCommand : unit -> System.Data.Common.DbCommand
Public Function GetDeleteCommand () As DbCommand
Restituisce
L'oggetto DbCommand generato automaticamente richiesto per eseguire le operazioni di eliminazione.The automatically generated DbCommand object required to perform deletions.
Commenti
Un'applicazione può utilizzare il GetDeleteCommand metodo a scopo informativo o di risoluzione dei problemi perché restituisce l' DbCommand oggetto da eseguire.An application can use the GetDeleteCommand method for informational or troubleshooting purposes because it returns the DbCommand object to be executed.
È anche possibile usare GetDeleteCommand come base di un comando modificato.You can also use GetDeleteCommand as the basis of a modified command. Ad esempio, è possibile chiamare GetDeleteCommand e modificare il testo del comando, quindi impostarlo in modo esplicito su DbDataAdapter .For example, you might call GetDeleteCommand and modify the command text, and then explicitly set that on the DbDataAdapter.
Dopo che l'istruzione SQL viene generata per la prima volta, l'applicazione deve chiamare in modo esplicito RefreshSchema se modifica l'istruzione in qualsiasi modo.After the SQL statement is first generated, the application must explicitly call RefreshSchema if it changes the statement in any way. In caso contrario, GetDeleteCommand utilizzerà ancora le informazioni dell'istruzione precedente, che potrebbero non essere corrette.Otherwise, the GetDeleteCommand will still be using information from the previous statement, which might not be correct. Le istruzioni SQL vengono innanzitutto generate quando l'applicazione chiama Update o GetDeleteCommand .The SQL statements are first generated either when the application calls Update or GetDeleteCommand.
Vedi anche
- Generazione di comandi tramite CommandBuildersGenerating Commands with CommandBuilders
- Cenni preliminari su ADO.NETADO.NET Overview
Si applica a
GetDeleteCommand(Boolean)
Ottiene l'oggetto DbCommand generato automaticamente, richiesto per eseguire le operazioni di eliminazione nell'origine dati, eventualmente utilizzando le colonne per i nomi dei parametri.Gets the automatically generated DbCommand object required to perform deletions at the data source, optionally using columns for parameter names.
public:
System::Data::Common::DbCommand ^ GetDeleteCommand(bool useColumnsForParameterNames);
public System.Data.Common.DbCommand GetDeleteCommand (bool useColumnsForParameterNames);
member this.GetDeleteCommand : bool -> System.Data.Common.DbCommand
Public Function GetDeleteCommand (useColumnsForParameterNames As Boolean) As DbCommand
Parametri
- useColumnsForParameterNames
- Boolean
Se true
, genera i nomi dei parametri dai nomi delle colonne, se possibile.If true
, generate parameter names matching column names, if possible. Se false
, genera @p1
, @p2
e così via.If false
, generate @p1
, @p2
, and so on.
Restituisce
L'oggetto DbCommand generato automaticamente richiesto per eseguire le operazioni di eliminazione.The automatically generated DbCommand object required to perform deletions.
Commenti
Un'applicazione può utilizzare il GetDeleteCommand metodo a scopo informativo o di risoluzione dei problemi perché restituisce l' DbCommand oggetto da eseguire.An application can use the GetDeleteCommand method for informational or troubleshooting purposes because it returns the DbCommand object to be executed.
È anche possibile usare GetDeleteCommand come base di un comando modificato.You can also use GetDeleteCommand as the basis of a modified command. Ad esempio, è possibile chiamare GetDeleteCommand e modificare il testo del comando, quindi impostarlo in modo esplicito su DbDataAdapter .For example, you might call GetDeleteCommand and modify the command text, and then explicitly set that on the DbDataAdapter.
Dopo che l'istruzione SQL viene generata per la prima volta, l'applicazione deve chiamare in modo esplicito RefreshSchema se modifica l'istruzione in qualsiasi modo.After the SQL statement is first generated, the application must explicitly call RefreshSchema if it changes the statement in any way. In caso contrario, GetDeleteCommand utilizzerà ancora le informazioni dell'istruzione precedente, che potrebbero non essere corrette.Otherwise, the GetDeleteCommand will still be using information from the previous statement, which might not be correct. Le istruzioni SQL vengono innanzitutto generate quando l'applicazione chiama Update o GetDeleteCommand .The SQL statements are first generated either when the application calls Update or GetDeleteCommand.
Il comportamento predefinito, quando si generano i nomi dei parametri, consiste nell'usare @p1
, @p2
e così via per i vari parametri.The default behavior, when generating parameter names, is to use @p1
, @p2
, and so on for the various parameters. Il passaggio true
del useColumnsForParameterNames
parametro consente di forzare la DbCommandBuilder generazione di parametri in base ai nomi di colonna.Passing true
for the useColumnsForParameterNames
parameter allows you to force the DbCommandBuilder to generate parameters based on the column names instead. Questa operazione ha esito positivo solo se vengono soddisfatte le condizioni seguenti:This succeeds only if the following conditions are met:
ParameterNameMaxLengthÈ stato specificato e la sua lunghezza è maggiore o uguale al nome del parametro generato.The ParameterNameMaxLength has been specified and its length is equal to or greater than the generated parameter name.
Il nome del parametro generato soddisfa i criteri specificati nell' ParameterNamePattern espressione regolare.The generated parameter name meets the criteria specified in the ParameterNamePattern regular expression.
ParameterMarkerFormatViene specificato un oggetto.A ParameterMarkerFormat is specified.
Vedi anche
- Generazione di comandi tramite CommandBuildersGenerating Commands with CommandBuilders
- Cenni preliminari su ADO.NETADO.NET Overview