/// <summary> /// 测试链接 /// </summary> /// <param name="instance">实例名称--连接标识</param> /// <param name="datasource">数据源(文件地址)</param> /// <param name="userid">访问数据库的帐户</param> /// <param name="password">访问数据库帐户的密码</param> /// <returns>是否成功</returns> public static Boolean TestConnect(string instance, string datasource, string userid, string password) { RDBHelper pDbHelper = new RDBHelper(DatabaseType.MSAccess); pDbHelper.User = userid; pDbHelper.dbFileName = datasource; pDbHelper.PWD = password; return(pDbHelper.Connect()); }
/// <summary> /// 测试链接 /// </summary> /// <param name="instance">实例名称--连接标识</param> /// <param name="server">数据库所在服务器</param> /// <param name="port">端口</param> /// <param name="database">数据库名称(数据库实例名称)</param> /// <param name="userid">访问数据库的帐户</param> /// <param name="password">访问数据库帐户的密码</param> /// <param name="dataBaseType">连接类型</param> /// <returns>是否成功</returns> public static Boolean TestConnect(string instance, string server, string port, string database, string userid, string password, DatabaseType dataBaseType) { RDBHelper pDbHelper = new RDBHelper(dataBaseType); pDbHelper.Server = server; pDbHelper.Service = database; pDbHelper.Port = port; pDbHelper.User = userid; pDbHelper.PWD = password; return(pDbHelper.Connect()); }