'Declaration
Public MustOverride Function PrepareSQLStatement( _ ByVal sqlStmt As String, _ ByVal cmdType As CommandType, _ ByVal commandParams As DataParameterCollection _ ) As String
public abstract string PrepareSQLStatement( string sqlStmt, CommandType cmdType, DataParameterCollection commandParams )
This method will replace special tokens with statements or parameter names according to the type of query and parameters passed in. For example, the {DATE} token will be replaced with the database type's special date statement (as returned by the GetDateStatement Method). Parameters are specified using the {n} syntax where n is an ascending number. The number of {n} parameters must match the number of parameters specified in the commandParams argument.
For example, the string:
SELECT {DATE} AS CurDate FROM some_table WHERE name = {0} AND id = {1}
with the parameters named "nameVal" and "idVal" will be formatted as such with an MSSQL provider:
SELECT GETDATE() AS CurDate FROM some_table WHERE name = @nameVal AND id = @idVal
This statement can then be executed against the database using an ADO.NET IDbCommand instance, or the SqlHelper class.
NOTE: SqlHelper will automatically call this method during Execute* methods like ExecuteNonQuery or ExecuteDataSet. Generally, this method should not be called directly, only through SqlHelper.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family