本文整理汇总了C#中IDbDataAdapter类的典型用法代码示例。如果您正苦于以下问题:C# IDbDataAdapter类的具体用法?C# IDbDataAdapter怎么用?C# IDbDataAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDbDataAdapter类属于命名空间,在下文中一共展示了IDbDataAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataSource
public DataSource(
string name, DataProvider provider, string connectionStringName,
string dataOperationsPath,
string parameterNamePrefix,
int commandTimeout)
{
_name = name;
_provider = provider;
ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings[connectionStringName];
if (settings == null)
throw new DataAccessException(ResourceStringLoader.GetResourceString(
"connection_string_not_found", connectionStringName));
_connectionStringName = connectionStringName;
_templateConnection = (IDbConnection)Activator.CreateInstance(
_provider.ConnectionObjectType);
_templateCommand = (IDbCommand)Activator.CreateInstance(
_provider.CommandObjectType);
if(_provider.DataAdapterObjectType != null)
_templateDataAdapter = (IDbDataAdapter)Activator.CreateInstance(
_provider.DataAdapterObjectType);
_parameterNamePrefix = provider.ParameterNamePrefix;
_commandTimeout = commandTimeout;
_operationFactory = new DataOperationFactory(this, dataOperationsPath);
}
示例2: GetDBCommandBuilder
public DbCommandBuilder GetDBCommandBuilder( IDbDataAdapter dbDataAdapter )
{
if ( dbDataAdapter is OleDbDataAdapter ) {
return new OleDbCommandBuilder ( ( OleDbDataAdapter ) dbDataAdapter );
} else {
throw new Exception ( "dbDataAdapter must be OleDbDataAdapter" );
}
}
示例3: ProfiledDbDataAdapter
/// <summary>
/// Initialises a new instance of the <see cref="ProfiledDbDataAdapter"/> class.
/// </summary>
/// <param name="wrappedAdapter">The wrapped adapter.</param>
/// <param name="profiler">The profiler.</param>
public ProfiledDbDataAdapter(IDbDataAdapter wrappedAdapter, IDbProfiler profiler = null)
{
if (wrappedAdapter == null)
{
throw new ArgumentNullException("wrappedAdapter");
}
_adapter = wrappedAdapter;
_profiler = profiler ?? MiniProfiler.Current;
}
示例4: TransactionalExecutionState
public TransactionalExecutionState(IDbConnection connection, IDbDataAdapter adapter)
{
if (connection.State != ConnectionState.Closed)
{
throw new ArgumentOutOfRangeException("connection", "Connection cannot be open!");
}
_connection = connection;
_adapter = adapter;
}
示例5: SQLAnywhereDataAdapter
public SQLAnywhereDataAdapter()
{
m_asmSqlClient = Assembly.LoadWithPartialName(m_sAssemblyName);
if ( m_asmSqlClient == null )
throw(new Exception("Could not load " + m_sAssemblyName));
m_typSqlDataAdapter = m_asmSqlClient.GetType(m_sDataAdapterName);
ConstructorInfo info = m_typSqlDataAdapter.GetConstructor(new Type[0]);
m_dbDataAdapter = info.Invoke(null) as IDbDataAdapter;
if ( m_dbDataAdapter == null )
throw(new Exception("Failed to invoke database adapter constructor."));
}
示例6: ExtractTableParameters
public void ExtractTableParameters(string TableName, IDbDataAdapter adapter,
out DatabaseCache InsertCache,
out DatabaseCache DeleteCache,
out DatabaseCache UpdateCache,
out DatabaseCache IsExistCache,
out DataTable dt
)
{
adapter.SelectCommand.CommandText = "select top 1 * from " + TableName;
DataSet ds = new DataSet();
dt = adapter.FillSchema(ds, SchemaType.Source)[0];
dt.TableName = TableName;
SqlCommandBuilder builder = new SqlCommandBuilder(adapter as SqlDataAdapter);
builder.ConflictOption = ConflictOption.OverwriteChanges;
//builder.SetAllValues = false;
SqlCommand InsertCmd = builder.GetInsertCommand(true);
builder.ConflictOption = ConflictOption.OverwriteChanges;
InsertCache = new DatabaseCache(InsertCmd.CommandText, InsertCmd.Parameters);
InsertCache.CurrentTable = dt;
foreach (DataColumn c in dt.Columns)
{
if (c.AutoIncrement)
{
InsertCache.IsHaveAutoIncrement = true;
InsertCache.SQL += ";Select @@IDENTITY;";
break;
}
}
SqlCommand UpdateCmd = builder.GetUpdateCommand(true);
UpdateCache = new DatabaseCache(UpdateCmd.CommandText, UpdateCmd.Parameters);
UpdateCache.CurrentTable = dt;
SqlCommand DeleteCmd = builder.GetDeleteCommand(true);
DeleteCache = new DatabaseCache(DeleteCmd.CommandText, DeleteCmd.Parameters);
DeleteCache.CurrentTable = dt;
IsExistCache = new DatabaseCache(DeleteCmd.CommandText, DeleteCmd.Parameters);
IsExistCache.CurrentTable = dt;
IsExistCache.SQL = IsExistCache.SQL.Replace("DELETE FROM [" + TableName + "]", "Select count(1) from [" + TableName + "] with(nolock) ");
}
示例7: DataSetAdapter
public DataSetAdapter(
string adapterName,
IDbDataAdapter dbDataAdapter,
DataSource dataSource,
IDataCommand selectCommand,
IDataCommand updateCommand,
IDataCommand insertCommand,
IDataCommand deleteCommand)
: this(adapterName, dataSource)
{
_dbDataAdapter = dbDataAdapter;
_selectCommand = selectCommand;
_updateCommand = updateCommand;
_insertCommand = insertCommand;
_deleteCommand = deleteCommand;
}
示例8: Listar
internal LsUf Listar()
{
try
{
var m_oUf = new LsUf();
sbSQL.Length = 0;
sbSQL.Append("SELECT CDUNDDFEDR, IDPRO021, NMUNDDFEDR");
sbSQL.Append(" FROM TBPRO021");
oAdapter = ObterDataAdapter(sbSQL.ToString());
ITableMapping objMapping = oAdapter.TableMappings.Add("Table", LsUf.tbUf);
objMapping.ColumnMappings.Add("CDUNDDFEDR", LsUf.cpSigla);
objMapping.ColumnMappings.Add("IDPRO021", LsUf.cpCodigo);
objMapping.ColumnMappings.Add("NMUNDDFEDR", LsUf.cpNome);
oAdapter.Fill(m_oUf);
return m_oUf;
}
catch (Exception ex)
{
throw new Dor.Util.OperacaoInvalidaBD(ex);
}
}
示例9: Listar
internal LsMenu Listar()
{
try
{
var m_oMenu = new LsMenu();
sbSQL.Length = 0;
sbSQL.Append("SELECT IDPRO018, IDPRO039, IDSUBMENU, NMMENU, NMPAGN");
sbSQL.Append(" FROM TBPRO039 ");
oAdapter = ObterDataAdapter(sbSQL.ToString());
ITableMapping objMapping = oAdapter.TableMappings.Add("Table", LsMenu.tbMenu);
objMapping.ColumnMappings.Add("IDPRO018", LsMenu.cpCodigoProjeto);
objMapping.ColumnMappings.Add("IDPRO039", LsMenu.cpCodigo);
objMapping.ColumnMappings.Add("IDSUBMENU", LsMenu.cpSubMenu);
objMapping.ColumnMappings.Add("NMMENU", LsMenu.cpNome);
objMapping.ColumnMappings.Add("NMPAGN", LsMenu.cpPagina);
oAdapter.Fill(m_oMenu);
return m_oMenu;
}
catch (Exception ex)
{
throw new Dor.Util.OperacaoInvalidaBD(ex);
}
}
示例10: Listar
internal LsOperacao Listar()
{
try
{
var m_oOperacao = new LsOperacao();
sbSQL.Length = 0;
sbSQL.Append("SELECT DSAPLDOPRC, IDPRO020, NMOPRC");
sbSQL.Append(" FROM TBPRO020");
oAdapter = ObterDataAdapter(sbSQL.ToString());
ITableMapping objMapping = oAdapter.TableMappings.Add("Table" , LsOperacao.tbOperacao);
objMapping.ColumnMappings.Add("DSAPLDOPRC","Apelido");
objMapping.ColumnMappings.Add("IDPRO020","Codigo");
objMapping.ColumnMappings.Add("NMOPRC","Nome");
oAdapter.Fill(m_oOperacao);
return m_oOperacao;
}
catch (Exception ex)
{
throw new Dor.Util.OperacaoInvalidaBD(ex);
}
}
示例11: Listar
internal LsSumario_Procedimento Listar()
{
try
{
var m_oSumario_Procedimento = new LsSumario_Procedimento();
sbSQL.Length = 0;
//sbSQL.Append("SELECT IDINT063, IDINT058, DSPRC, DTPRC");
//sbSQL.Append(" FROM TBINT063");
sbSQL.Append("SELECT IDINT063, IDINT058, DSPRC, DTPRC");
sbSQL.Append(" FROM TBINT063 WHERE IDINT058 = " + Convert.ToInt32(UtSessao.Sessao["Id058"]));
oAdapter = ObterDataAdapter(sbSQL.ToString());
ITableMapping objMapping = oAdapter.TableMappings.Add("Table" , LsSumario_Procedimento.tbSumario_Procedimento);
objMapping.ColumnMappings.Add("IDINT063",LsSumario_Procedimento.cpCodigo);
objMapping.ColumnMappings.Add("IDINT058",LsSumario_Procedimento.cpidint058);
objMapping.ColumnMappings.Add("DSPRC",LsSumario_Procedimento.cpnome);
objMapping.ColumnMappings.Add("DTPRC",LsSumario_Procedimento.cpdtprc);
oAdapter.Fill(m_oSumario_Procedimento);
return m_oSumario_Procedimento;
}
catch (Exception en)
{
throw new Dor.Util.OperacaoInvalidaBD(en);
}
}
示例12: Listar
internal LsPerfil Listar()
{
try
{
var m_oPerfil = new LsPerfil();
sbSQL.Length = 0;
sbSQL.Append("SELECT DSAPLDPERF, IDPRO016, NMPERF");
sbSQL.Append(" FROM TBPRO016");
sbSQL.Append(" ORDER BY NMPERF");
oAdapter = ObterDataAdapter(sbSQL.ToString());
ITableMapping objMapping = oAdapter.TableMappings.Add("Table", LsPerfil.tbPerfil);
objMapping.ColumnMappings.Add("DSAPLDPERF", LsPerfil.cpApelido);
objMapping.ColumnMappings.Add("IDPRO016", LsPerfil.cpCodigo);
objMapping.ColumnMappings.Add("NMPERF", LsPerfil.cpNome);
oAdapter.Fill(m_oPerfil);
return m_oPerfil;
}
catch (Exception ex)
{
throw new Dor.Util.OperacaoInvalidaBD(ex);
}
}
示例13: Listar
internal LsDireito Listar()
{
try
{
var m_oDireito = new LsDireito();
sbSQL.Length = 0;
sbSQL.Append("SELECT DSAPLDDIRT, IDPRO017, NMDIRT");
sbSQL.Append(" FROM TBPRO017");
oAdapter = ObterDataAdapter(sbSQL.ToString());
ITableMapping objMapping = oAdapter.TableMappings.Add("Table", LsDireito.tbDireito);
objMapping.ColumnMappings.Add("DSAPLDDIRT", LsDireito.cpApelido);
objMapping.ColumnMappings.Add("IDPRO017", LsDireito.cpCodigo);
objMapping.ColumnMappings.Add("NMDIRT", LsDireito.cpNome);
oAdapter.Fill(m_oDireito);
return m_oDireito;
}
catch (Exception ex)
{
throw new Dor.Util.OperacaoInvalidaBD(ex);
}
}
示例14: Listar
internal LsSumario_Antimicrobiano Listar()
{
try
{
var m_oSumario_Antimicrobiano = new LsSumario_Antimicrobiano();
sbSQL.Length = 0;
sbSQL.Append("SELECT IDINT064, IDINT058, DSANTI, DSPERI");
sbSQL.Append(" FROM TBINT064 WHERE IDINT058 = " + Convert.ToInt32(UtSessao.Sessao["Id058"]));
oAdapter = ObterDataAdapter(sbSQL.ToString());
ITableMapping objMapping = oAdapter.TableMappings.Add("Table" , LsSumario_Antimicrobiano.tbSumario_Antimicrobiano);
objMapping.ColumnMappings.Add("IDINT064",LsSumario_Antimicrobiano.cpCodigo);
objMapping.ColumnMappings.Add("IDINT058",LsSumario_Antimicrobiano.cpidint058);
objMapping.ColumnMappings.Add("DSANTI",LsSumario_Antimicrobiano.cpnome);
objMapping.ColumnMappings.Add("DSPERI",LsSumario_Antimicrobiano.cpdsperi);
oAdapter.Fill(m_oSumario_Antimicrobiano);
return m_oSumario_Antimicrobiano;
}
catch (Exception en)
{
throw new Dor.Util.OperacaoInvalidaBD(en);
}
}
示例15: Listar
internal LsPerfilFuncao Listar()
{
try
{
var m_oPerfilFuncao = new LsPerfilFuncao();
sbSQL.Length = 0;
sbSQL.Append("SELECT IDDOR033, IDPRO016, IDPRO031");
sbSQL.Append(" FROM TBPRO033");
oAdapter = ObterDataAdapter(sbSQL.ToString());
ITableMapping objMapping = oAdapter.TableMappings.Add("Table", LsPerfilFuncao.tbPerfilFuncao);
objMapping.ColumnMappings.Add("IDDOR033", "Codigo");
objMapping.ColumnMappings.Add("IDPRO016", "CodigoPerfil");
objMapping.ColumnMappings.Add("IDPRO031", "CodigoFuncao");
oAdapter.Fill(m_oPerfilFuncao);
return m_oPerfilFuncao;
}
catch (Exception ex)
{
throw new Dor.Util.OperacaoInvalidaBD(ex);
}
}