本文整理汇总了C#中IDbParameters类的典型用法代码示例。如果您正苦于以下问题:C# IDbParameters类的具体用法?C# IDbParameters怎么用?C# IDbParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDbParameters类属于命名空间,在下文中一共展示了IDbParameters类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: IDbCommandCreatorFactory
/// <summary>
/// Initializes a new instance of the <see cref="IDbCommandCreatorFactory"/> class.
/// </summary>
public IDbCommandCreatorFactory(IDbProvider dbProvider, CommandType commandType, string sql, IDbParameters declaredParameters)
{
this.dbProvider = dbProvider;
this.sql = sql;
this.commandType = commandType;
this.declaredParameters = declaredParameters;
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:10,代码来源:IDbCommandCreatorFactory.cs
示例2: CopyParameters
/// <summary>
/// Copies the parameters from IDbParameters to the parameter collection in IDbCommand
/// </summary>
/// <param name="command">The command.</param>
/// <param name="springParamCollection">The spring param collection.</param>
public static void CopyParameters(IDbCommand command, IDbParameters springParamCollection)
{
if (springParamCollection != null)
{
IDataParameterCollection collection = springParamCollection.DataParameterCollection;
foreach (IDbDataParameter parameter in collection)
{
IDbDataParameter pClone = (IDbDataParameter)((ICloneable)parameter).Clone();
command.Parameters.Add(pClone);
}
}
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:18,代码来源:ParameterUtils.cs
示例3: ExecuteQueryAll
public DataTable ExecuteQueryAll(string tableName, IDbParameters parameters,string paramMark)
{
string query = "SELECT * FROM " + tableName;
if(parameters.Count > 0)
{
query += " WHERE ";
}
int countParams = 0;
foreach (IDataParameter dbParameter in parameters.DataParameterCollection)
{
countParams++;
if (countParams > 1) query += " AND ";
string columnName = dbParameter.ParameterName;
if(columnName.StartsWith("@")) columnName = columnName.Substring(1);
query += " " + columnName + "=" + paramMark + dbParameter.ParameterName;
}
return AdoTemplate.DataTableCreateWithParams(CommandType.Text, query, parameters);
}
开发者ID:DelLitt,项目名称:opmscoral,代码行数:19,代码来源:PosDatabase.cs
示例4: DataAdapterFillCallback
public DataAdapterFillCallback(DataTable dataTable,
CommandType commandType,
string sql,
ITableMappingCollection mappingCollection,
IDataAdapterSetter dataAdapterSetter,
IDataSetFillLifecycleProcessor fillLifecycleProcessor,
IDbParameters parameters)
{
containsDataSet = false;
this.dataTable = dataTable;
this.commandType = commandType;
this.sql = sql;
this.mappingCollection = mappingCollection;
this.dataAdapterSetter = dataAdapterSetter;
this.fillLifecycleProcessor = fillLifecycleProcessor;
this.parameters = parameters;
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:17,代码来源:AdoTemplate.cs
示例5: DataTableUpdate
public virtual int DataTableUpdate(DataTable dataTable,
string tableName,
CommandType insertCommandtype, string insertSql, IDbParameters insertParameters,
CommandType updateCommandtype, string updateSql, IDbParameters updateParameters,
CommandType deleteCommandtype, string deleteSql, IDbParameters deleteParameters,
IDataAdapterSetter dataAdapterSetter)
{
ValidateUpdateArguments(dataTable, tableName);
ITableMappingCollection mappingCollection = DoCreateMappingCollection(new string[] { tableName });
return DataTableUpdate(dataTable, mappingCollection,
insertCommandtype, insertSql, insertParameters,
updateCommandtype, updateSql, updateParameters,
deleteCommandtype, deleteSql, deleteParameters,
dataAdapterSetter);
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:15,代码来源:AdoTemplate.cs
示例6: QueryForObjectDelegate
/// <summary>
/// Execute a query with the specified command text and parameters, mapping a single result row
/// to an object via a RowMapper.
/// </summary>
/// <param name="cmdType">The command type.</param>
/// <param name="cmdText">The command text to execute.</param>
/// <param name="rowMapperDelegate">delegate that will map one object per row</param>
/// <param name="parameters">The parameter collection to use in the query.</param>
/// <returns>The single mapped object.</returns>
/// <exception cref="Spring.Dao.IncorrectResultSizeDataAccessException">
/// If the query does not return exactly one row.
/// </exception>
/// <exception cref="Spring.Dao.DataAccessException">
/// If there is any problem executing the query.
/// </exception>
public virtual object QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, IDbParameters parameters)
{
IList results = QueryWithRowMapperDelegate(cmdType, cmdText, rowMapperDelegate, parameters);
return DataAccessUtils.RequiredUniqueResultSet(results);
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:20,代码来源:AdoTemplate.cs
示例7: QueryWithRowMapperDelegate
public virtual IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate,
IDbParameters parameters)
{
return (IList)QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor(rowMapperDelegate), parameters);
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:5,代码来源:AdoTemplate.cs
示例8: QueryWithRowCallback
public virtual void QueryWithRowCallback(CommandType cmdType, string cmdText, IRowCallback rowCallback, IDbParameters parameters)
{
QueryWithResultSetExtractor(cmdType, cmdText, new RowCallbackResultSetExtractor(rowCallback), parameters);
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:4,代码来源:AdoTemplate.cs
示例9: ExecuteNonQuery
/// <summary>
/// Executes a non query returning the number of rows affected.
/// </summary>
/// <param name="cmdType">The command type.</param>
/// <param name="cmdText">The command text to execute.</param>
/// <param name="parameters">The parameter collection to map.</param>
/// <returns>The number of rows affected.</returns>
public virtual int ExecuteNonQuery(CommandType cmdType, string cmdText,
IDbParameters parameters)
{
#region Instrumentation
if (LOG.IsDebugEnabled)
{
LOG.Debug("Executing NonQuery. " + cmdType + "[" + cmdText + "]");
}
#endregion
return (int)Execute(new ExecuteNonQueryCallbackWithParameters(cmdType, cmdText, parameters));
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:20,代码来源:AdoTemplate.cs
示例10: ExecuteScalarCallbackWithParameters
public ExecuteScalarCallbackWithParameters(CommandType cmdType, string cmdText, IDbParameters dbParameters)
{
commandType = cmdType;
commandText = cmdText;
parameters = dbParameters;
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:6,代码来源:AdoTemplate.cs
示例11: DataSetFillWithParameters
public virtual int DataSetFillWithParameters(DataSet dataSet, CommandType commandType, string sql,
IDbParameters parameters,
ITableMappingCollection tableMapping,
IDataAdapterSetter dataAdapterSetter,
IDataSetFillLifecycleProcessor fillLifecycleProcessor)
{
ValidateFillWithParameterArguments(dataSet, sql, parameters, tableMapping);
return (int)Execute(new DataAdapterFillCallback(dataSet,
commandType, sql,
tableMapping, dataAdapterSetter, fillLifecycleProcessor, parameters));
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:11,代码来源:AdoTemplate.cs
示例12: DataSetCreateWithParams
public virtual DataSet DataSetCreateWithParams(CommandType commandType, string sql,
IDbParameters parameters,
ITableMappingCollection tableMapping,
IDataAdapterSetter dataAdapterSetter,
IDataSetFillLifecycleProcessor fillLifecycleProcessor)
{
DataSet dataSet = CreateDataSet();
DataSetFillWithParameters(dataSet, commandType, sql, parameters, tableMapping, dataAdapterSetter, fillLifecycleProcessor);
return dataSet;
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:10,代码来源:AdoTemplate.cs
示例13: DataAdapterUpdateWithCommandBuilderCallback
public DataAdapterUpdateWithCommandBuilderCallback(DataTable dataTable,
object commandBuilder,
ITableMappingCollection mappingCollection,
CommandType selectCommandType,
string selectSql,
IDbParameters selectParameters,
IDataAdapterSetter dataAdapterSetter)
{
containsDataSet = false;
this.dataTable = dataTable;
this.commandBuilder = commandBuilder;
this.mappingCollection = mappingCollection;
this.selectCommandType = selectCommandType;
this.selectSql = selectSql;
this.selectParameters = selectParameters;
this.dataAdapterSetter = dataAdapterSetter;
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:17,代码来源:AdoTemplate.cs
示例14: ExecuteNonQueryCallbackWithParameters
public ExecuteNonQueryCallbackWithParameters(CommandType commandType, string commandText, IDbParameters dbParameters)
{
this.commandType = commandType;
this.commandText = commandText;
parameters = dbParameters;
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:6,代码来源:AdoTemplate.cs
示例15: DataSetUpdateWithCommandBuilder
public virtual int DataSetUpdateWithCommandBuilder(DataSet dataSet,
CommandType commandType,
string selectSql,
IDbParameters selectParameters,
string tableName)
{
ValidateUpdateWithCommandBuilderArguments(dataSet, tableName, selectSql);
ITableMappingCollection mappingCollection = DoCreateMappingCollection(new string[] { tableName });
return (int)Execute(new DataAdapterUpdateWithCommandBuilderCallback(dataSet,
DbProvider.CreateCommandBuilder(),
mappingCollection,
commandType,
selectSql,
selectParameters,
null));
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:16,代码来源:AdoTemplate.cs
示例16: QueryCallback
public QueryCallback(AdoTemplate adoTemplate, CommandType cmdType, string cmdText, ResultSetExtractorDelegate resultSetExtractorDelegate, IDbParameters dbParameters)
{
this.adoTemplate = adoTemplate;
commandType = cmdType;
commandText = cmdText;
this.resultSetExtractorDelegate = resultSetExtractorDelegate;
parameters = dbParameters;
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:8,代码来源:AdoTemplate.cs
示例17: ExecuteScalar
/// <summary>
/// Execute the query with the specified command text and parameters returning a scalar result
/// </summary>
/// <param name="cmdType">The command type</param>
/// <param name="cmdText">The command text to execute.</param>
/// <param name="parameters">The parameter collection to map.</param>
/// <returns>The first column of the first row in the result set</returns>
public virtual object ExecuteScalar(CommandType cmdType, string cmdText,
IDbParameters parameters)
{
return Execute(new ExecuteScalarCallbackWithParameters(cmdType, cmdText, parameters));
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:13,代码来源:AdoTemplate.cs
示例18: DataSetUpdate
public virtual int DataSetUpdate(DataSet dataSet,
string tableName,
CommandType insertCommandtype, string insertSql, IDbParameters insertParameters,
CommandType updateCommandtype, string updateSql, IDbParameters updateParameters,
CommandType deleteCommandtype, string deleteSql, IDbParameters deleteParameters)
{
ValidateUpdateArguments(dataSet, tableName);
IDbCommand insertCommand = null;
if (insertSql != null)
{
insertCommand = DbProvider.CreateCommand();
insertCommand.CommandType = insertCommandtype;
insertCommand.CommandText = insertSql;
ParameterUtils.CopyParameters(insertCommand, insertParameters);
}
IDbCommand updateCommand = null;
if (updateSql != null)
{
updateCommand = DbProvider.CreateCommand();
updateCommand.CommandType = updateCommandtype;
updateCommand.CommandText = updateSql;
ParameterUtils.CopyParameters(updateCommand, updateParameters);
}
IDbCommand deleteCommand = null;
if (deleteSql != null)
{
deleteCommand = DbProvider.CreateCommand();
deleteCommand.CommandType = deleteCommandtype;
deleteCommand.CommandText = deleteSql;
ParameterUtils.CopyParameters(deleteCommand, deleteParameters);
}
ITableMappingCollection mappingCollection = DoCreateMappingCollection(new string[] { tableName });
int returnVal = (int)Execute(new DataAdapterUpdateCallback(dataSet, mappingCollection,
insertCommand, updateCommand, deleteCommand, null));
if (insertSql != null)
{
ParameterUtils.CopyParameters(insertParameters, insertCommand);
}
if (updateSql != null)
{
ParameterUtils.CopyParameters(updateParameters, updateCommand);
}
if (deleteSql != null)
{
ParameterUtils.CopyParameters(deleteParameters, deleteCommand);
}
return returnVal;
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:50,代码来源:AdoTemplate.cs
示例19: QueryWithRowCallbackDelegate
public virtual void QueryWithRowCallbackDelegate(CommandType cmdType, string sql, RowCallbackDelegate rowCallbackDelegate, IDbParameters parameters)
{
QueryWithResultSetExtractor(cmdType, sql, new RowCallbackResultSetExtractor(rowCallbackDelegate), parameters);
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:5,代码来源:AdoTemplate.cs
示例20: QueryWithResultSetExtractorDelegate
public virtual object QueryWithResultSetExtractorDelegate(CommandType cmdType, string cmdText, ResultSetExtractorDelegate resultSetExtractorDelegate,
IDbParameters parameters)
{
AssertUtils.ArgumentNotNull(resultSetExtractorDelegate, "resultSetExtractorDelegate", "Result set extractor delegate must not be null");
return Execute(new QueryCallback(this, cmdType, cmdText, resultSetExtractorDelegate, parameters));
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:6,代码来源:AdoTemplate.cs
注:本文中的IDbParameters类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论