//------------------------------------------------------------------------------------------------ public static CResultAErreur CreateDatabase(IDatabaseConnexion connexion) { CResultAErreur result = CResultAErreur.True; if (!connexion.IsConnexionValide()) { if (connexion is COleDbDatabaseConnexion) { string strConnexionString = connexion.ConnexionString; //Trouve le nom de la base Regex findName = new Regex("Data Source[ ]*=[ ]*(.*);?", RegexOptions.IgnoreCase); Match match = findName.Match(strConnexionString); string strBase = ""; if (match != null) { strBase = match.Value; string[] strVals = strBase.Split('='); if (strVals.Length > 1) { strBase = strVals[1].Split(';') [0]; } } if (!File.Exists(strBase)) { System.Reflection.Assembly thisExe; thisExe = System.Reflection.Assembly.GetExecutingAssembly(); Stream source = thisExe.GetManifestResourceStream("sc2i.data.serveur.BASEVIDE.MDB"); if (strBase == "") { result.EmpileErreur(I.T("Impossible to determine the database name|123")); return(result); } Stream dest = new FileStream(strBase, FileMode.CreateNew); result = CStreamCopieur.CopyStream(source, dest, 2048); dest.Close(); if (!result) { return(result); } } } else { result.EmpileErreur(I.T("'CreateDatabase' function not possible for connection @1|124", connexion.GetType().Name)); } } return(result); }