摘要: 通常项目需要支持多种类型的数据库,比如MySql, Oracle11g, SqlServer. 在代码中封装数据的的时候,一般使用工厂模式, 根据配置文件中的DBType创建数据库。首先,数据库配置文件中需要配置以下内容: MySql55 localhost testdb root test2012其次,根据配置文件内容,创建数据库连接串,不同数据库的connectionString 有所不同, 所以需要用各自的方法建立各自的字符串: public static string CreateConnectionString(DBType dbType, string dbHost, s... 阅读全文
posted @ 2013-07-05 14:49 月光-日光海岸 阅读(478) 评论(0) 推荐(1) 编辑