SqlCommand.Prepare Method ()
Creates a prepared version of the command on an instance of SQL Server.
Assembly: System.Data (in System.Data.dll)
If CommandType is set to StoredProcedure, the call to should succeed, although it may cause a no-op.
Before you call Size property to the maximum size needed. returns an error if these conditions are not met., specify the data type of each parameter in the statement to be prepared. For each parameter that has a variable length data type, you must set the
If the database context is changed by executing the Transact-SQL USE <database> statement, or by calling the ChangeDatabase method, then must be called a second time.
If you call an Execute method after calling Size property is automatically truncated to the original specified size of the parameter, and no truncation errors are returned., any parameter value that is larger than the value specified by the
Output parameters (whether prepared or not) must have a user-specified data type. If you specify a variable length data type, you must also specify the maximum Size.
Prior to Visual Studio 2010,threw an exception. Beginning in Visual Studio 2010, this method does not throw an exception.
Available since 1.1