• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IDbDataAdapter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IDbDataAdapter的典型用法代码示例。如果您正苦于以下问题:C# IDbDataAdapter类的具体用法?C# IDbDataAdapter怎么用?C# IDbDataAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IDbDataAdapter类属于命名空间,在下文中一共展示了IDbDataAdapter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
        }
开发者ID:kohku,项目名称:codefactory,代码行数:30,代码来源:DataSource.cs


示例2: GetDBCommandBuilder

 public DbCommandBuilder GetDBCommandBuilder( IDbDataAdapter dbDataAdapter )
 {
     if ( dbDataAdapter is OleDbDataAdapter ) {
         return new OleDbCommandBuilder ( ( OleDbDataAdapter ) dbDataAdapter );
     } else {
         throw new Exception ( "dbDataAdapter must be OleDbDataAdapter" );
     }
 }
开发者ID:phospher,项目名称:SchoolEndORM,代码行数:8,代码来源:OleDbDriverFactory.cs


示例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;
        }
开发者ID:haroonxml,项目名称:dotnet,代码行数:15,代码来源:ProfiledDbDataAdapter.cs


示例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;
        }
开发者ID:joshuaflanagan,项目名称:structuremap,代码行数:10,代码来源:TransactionalExecutionState.cs


示例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."));
        }
开发者ID:NALSS,项目名称:splendidcrm-99885,代码行数:12,代码来源:SQLAnywhereDataAdapter.cs


示例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) ");
        }
开发者ID:xqgzh,项目名称:Z,代码行数:48,代码来源:SqlServer.cs


示例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;
        }
开发者ID:kohku,项目名称:codefactory,代码行数:16,代码来源:DataSetAdapter.cs


示例8: CriarAdapter

        public IDbDataAdapter CriarAdapter(string xQuery)
        {
            switch (banco)
            {
                case Banco.SQLSERVER:
                    dbAdapter = new SqlDataAdapter(xQuery,(SqlConnection) dbConnection);
                    break;
                case Banco.ORACLE:
                    //dbAdapter = new OracleDataAdapter(xQuery, (OracleConnection)dbConnection);
                    dbAdapter = new SqlDataAdapter(xQuery, (SqlConnection)dbConnection);
                    break;
                default:
                    break;
            }

            return dbAdapter;
        }
开发者ID:Workker,项目名称:ETLRedeDor,代码行数:17,代码来源:EngineFactory.cs


示例9: InitCommands

 private void InitCommands(IDbDataAdapter wrappedAdapter)
 {
     if (wrappedAdapter.SelectCommand != null)
     {
         _selectCommand = wrappedAdapter.SelectCommand;
     }
     if (wrappedAdapter.DeleteCommand != null)
     {
         _deleteCommand = wrappedAdapter.DeleteCommand;
     }
     if (wrappedAdapter.UpdateCommand != null)
     {
         _updateCommand = wrappedAdapter.UpdateCommand;
     }
     if (wrappedAdapter.InsertCommand != null)
     {
         _insertCommand = wrappedAdapter.InsertCommand;
     }
 }
开发者ID:BiYiTuan,项目名称:dotnet,代码行数:19,代码来源:ProfiledDbDataAdapter.cs


示例10: DisposeDataAdapterCommands

	    public static void DisposeDataAdapterCommands(IDbDataAdapter adapter)
        {
            if (adapter.SelectCommand != null)
            {
                DoDisposeCommand(adapter.SelectCommand);
            }
	        if (adapter.InsertCommand != null)
	        {
	            DoDisposeCommand(adapter.InsertCommand);
	        }
            if (adapter.UpdateCommand != null)
            {
                DoDisposeCommand(adapter.UpdateCommand);
            }
	        if (adapter.DeleteCommand != null)
	        {
	            DoDisposeCommand(adapter.DeleteCommand);
	        }

        }
开发者ID:Binodesk,项目名称:spring-net,代码行数:20,代码来源:AdoUtils.cs


示例11: Initialize

 public void Initialize()
 {
     Assembly assembly = null;
     Type type = null;
     try {
         assembly = Assembly.Load(this._assemblyName);
         type = assembly.GetType(this._dataAdapterClass, true);
         this.CheckPropertyType("DataAdapterClass", typeof(IDbDataAdapter), type);
         this._templateDataAdapter = (IDbDataAdapter)type.GetConstructor(Type.EmptyTypes).Invoke(null);
         type = assembly.GetType(this._connectionClass, true);
         this.CheckPropertyType("DbConnectionClass", typeof(IDbConnection), type);
         this._templateConnection = (IDbConnection)type.GetConstructor(Type.EmptyTypes).Invoke(null);
         this._commandBuilderType = assembly.GetType(this._commandBuilderClass, true);
         this._parameterDbType = assembly.GetType(this._parameterDbTypeClass, true);
         this._templateConnectionIsICloneable = this._templateConnection is ICloneable;
         this._templateDataAdapterIsICloneable = this._templateDataAdapter is ICloneable;
     }
     catch (Exception exception) {
         throw new Exception(string.Format("Could not configure providers. Unable to load provider named \"{0}\" not found, failed. Cause: {1}", this._name, exception.Message), exception);
     }
 }
开发者ID:jiang-w,项目名称:DataAccessHelper,代码行数:21,代码来源:DbProvider.cs


示例12: Initialize

        /// <summary>
        /// Init the provider.
        /// </summary>
        public void Initialize()
        {
            Assembly assembly = null;
            Type type = null;

            try
            {
                assembly = Assembly.Load(_assemblyName);

                // Build the DataAdapter template
                type = assembly.GetType(_dataAdapterClass, true);
                CheckPropertyType("DataAdapterClass", typeof(IDbDataAdapter), type);
                _templateDataAdapter = (IDbDataAdapter)type.GetConstructor(Type.EmptyTypes).Invoke(null);

                // Build the connection template
                type = assembly.GetType(_connectionClass, true);
                CheckPropertyType("DbConnectionClass", typeof(IDbConnection), type);
                _templateConnection = (IDbConnection)type.GetConstructor(Type.EmptyTypes).Invoke(null);

                // Get the CommandBuilder Type
                _commandBuilderType = assembly.GetType(_commandBuilderClass, true);
                if (_parameterDbTypeClass.IndexOf(',')>0)
                {
                    _parameterDbType = TypeUtils.ResolveType(_parameterDbTypeClass);
                }
                else
                {
                    _parameterDbType = assembly.GetType(_parameterDbTypeClass, true);
                }

                _templateConnectionIsICloneable = _templateConnection is ICloneable;
                _templateDataAdapterIsICloneable = _templateDataAdapter is ICloneable;
            }
            catch(Exception e)
            {
                throw new ConfigurationException(
                    string.Format("Could not configure providers. Unable to load provider named \"{0}\" not found, failed. Cause: {1}", _name, e.Message), e
                    );
            }
        }
开发者ID:hejiquan,项目名称:iBATIS_2010,代码行数:43,代码来源:DbProvider.cs


示例13: 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);
            }
        }
开发者ID:Workker,项目名称:SumarioDeAlta,代码行数:25,代码来源:rpUf.cs


示例14: 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);
            }
        }
开发者ID:Workker,项目名称:SumarioDeAlta,代码行数:27,代码来源:rpMenu.cs


示例15: 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);
              }
        }
开发者ID:Workker,项目名称:SumarioDeAlta,代码行数:25,代码来源:rpOperacao.cs


示例16: 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);
              }
        }
开发者ID:Workker,项目名称:SumarioDeAlta,代码行数:30,代码来源:rpSumario_Procedimento.cs


示例17: 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);
            }
        }
开发者ID:Workker,项目名称:SumarioDeAlta,代码行数:26,代码来源:rpPerfil.cs


示例18: 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);
            }
        }
开发者ID:Workker,项目名称:SumarioDeAlta,代码行数:25,代码来源:rpDireito.cs


示例19: 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);
              }
        }
开发者ID:Workker,项目名称:SumarioDeAlta,代码行数:26,代码来源:rpSumario_Antimicrobiano.cs


示例20: 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);
            }
        }
开发者ID:Workker,项目名称:SumarioDeAlta,代码行数:25,代码来源:rpPerfilFuncao.cs



注:本文中的IDbDataAdapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IDbDataParameter类代码示例发布时间:2022-05-24
下一篇:
C# IDbContextFactory类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap