Ejemplo n.º 1
0
 /// <summary>
 /// 连接到一个Access数据库。
 /// </summary>
 /// <param name="dataBase">数据库名称。</param>
 public void ConnectDb(string dataBase)
 {
     System.Data.OleDb.OleDbConnection oleConn = new System.Data.OleDb.OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=" + this.Server.MapPath(dataBase));
     doh = new SiteGroupCms.DBUtility.OleDbOperHandler(oleConn);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 连接Sql Server数据库。
 /// </summary>
 /// <param name="serverName">服务器地址。</param>
 /// <param name="userName">用户名。</param>
 /// <param name="password">密码。</param>
 /// <param name="dataBaseName">数据库名称。</param>
 public void ConnectDb(string serverName, string userName, string password, string dataBaseName)
 {
     System.Data.SqlClient.SqlConnection sqlConn = new System.Data.SqlClient.SqlConnection("server='" + serverName + "';uid=" + userName + ";pwd=" + password + ";database=" + dataBaseName);
     doh = new SiteGroupCms.DBUtility.SqlDbOperHandler(sqlConn);
 }