日期:2014-05-18 浏览次数:20872 次
DataOperate.strCon = "Data Source=LocalHost;Integrated Security=SSPI;Initial Catalog=master;"; string strSql = "EXEC sp_addlogin 'skyland','1818','es_CostumeStore_01_01'"; DataOperate.ExecuteCmd(strSql); DataOperate.strCon = "Data Source=LocalHost;Integrated Security=SSPI;Initial Catalog=es_CostumeStore_01_01;"; strSql = "sp_adduser 'skyland','skylandUser','db_owner'"; DataOperate.ExecuteCmd(strSql);
strSql += "RESTORE DATABASE es_CostumeStore_01_01 FROM DISK ='" + pDlg.FileName + "' "; strSql += " WITH MOVE 'es_CostumeStore_01_01_Data' TO '" + Application.StartupPath + @"\database\es_CostumeStore_01_01.MDF', "; strSql += " MOVE 'es_CostumeStore_01_01_Log' TO '" + Application.StartupPath + @"\database\es_CostumeStore_01_01_Log.LDF' "; SqlConnection con = new SqlConnection("server=" + strServer + ";database=master;uid=" + strLogonName + ";pwd=" + strPwd); SqlCommand sqlcmd = new SqlCommand(strSql, con);