I have been writing a Data library to hide Odbc, Ole,Sql, Oracle etc  
  
from the user and have been using the Idb interface.  
  
But there is no IDbCommandBuilder!Please help me, Thanks! 

解决方案 »

  1.   

    use public abstract class DbCommandBuilder
      

  2.   

    DbCommandBuilder公共基类包含了一个用于指示并发策略选择的属性
      

  3.   

    记得有个抽象类好像是DbCommandBuilder,试试吧。。
      

  4.   

    You can use System.Data.Common.DbCommandBuilder.
      

  5.   


    How to do it? can you write it,thanks!
      

  6.   

    It's simple to use,like below:System.Data.Common.DbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter(conStr, cmdStr);
    //Or OdbcDataAdapter/OracleDataAdapter
    System.Data.Common.DbCommandBuilder cb = new System.Data.Common.DbCommandBuilder(da);Then the sql for deleting,inserting,updating are all ready for the DbDataAdapter.
      

  7.   


    i run it ,and the error message is:错误 7 无法创建抽象类或接口“System.Data.Common.DbCommandBuilder”的实例
      

  8.   

    System.Data.Common.DbCommandBuilder cb = new System.Data.Common.OledbCommandBuilder(da); 
    DbCommandBuilder is an abstract class.Sorry!
      

  9.   

    Gao le ban tian hai shi mei jie jue wen ti ~~~
      

  10.   

    i want this Data library to hide Odbc, Ole,Sql, Oracle etc  ,
    should not use "OledbCommandBuilder"
      

  11.   

    using System.Data.Common.DbCommandBuilder
      

  12.   

    楼主是不是想用一个工厂模式的数据操作层?
    http://hi.baidu.com/isloveok/blog/item/44dd4f2dddbaed37359bf77c.html
      

  13.   

    是的,现在的问题是CommandBuilder的数据库无关没有解决
      

  14.   

    I think the abstract Factory pattern to create the DAL implementation is what you want.    public sealed class DataAccess {        // Look up the DAL implementation we should be using
            private static readonly string path = ConfigurationManager.AppSettings["commandbuilder"];        private DataAccess() { }        public static DbCommandBuilder CreateCommandBuilder() {
                string className = path + ".CommandBuilder";
                return (DbCommandBuilder)Assembly.Load(path).CreateInstance(className);
            }
        }You should add such information to web.config or app.config.When you wanna alter you database, you 
    can only modify the config file. <appSettings>
    <add key="commandbuilder" value="System.Data.Oledb.OledbCommandBuilder"/>
    <appSettings>
      

  15.   

    UP!
    I thought that I came to English BBS