public bool AttachDB(string dbName, string dbFile) { SQLDMO.SQLServer svr = new SQLDMO.SQLServerClass(); try { svr.Connect(ServerName, UserName, Password); svr.AttachDB(dbName, dbFile); return true; } catch (Exception err) { //throw (new Exception("��" + err.Message)); ShowError("�������ݿ�ʧ��" + err.Message); return false; } finally { svr.DisConnect(); } }
public bool AttachDB(string dbName, string dbFile) { SQLDMO.SQLServer svr = new SQLDMO.SQLServerClass(); try { svr.Connect(ServerName, UserName, Password); svr.AttachDB(dbName, dbFile); return(true); } catch (Exception err) { //throw (new Exception("!" + err.Message)); ShowError("附加数据库失败" + err.Message); return(false); } finally { svr.DisConnect(); } }