Exemple #1
0
        /// <summary>
        /// Copies the LM.
        /// </summary>
        /// <returns></returns>
        /// <remarks>Documented by Dev07, 2009-05-20</remarks>
        public static bool CopyLM(string source, string destination)
        {
            try
            {
                string filename = destination;
                if (File.Exists(filename))
                {
                    int i = 0;
                    while (File.Exists(filename.Replace(".mlm", "_" + i + ".mlm")))
                    {
                        i++;
                    }
                    filename = filename.Replace(".mlm", "_" + i + ".mlm");
                }

                string      sourceConString = MSSQLCEConn.GetFullConnectionString(source);
                string      desConString    = MSSQLCEConn.GetFullConnectionString(filename);
                SqlCeEngine engine          = new SqlCeEngine(sourceConString);
                engine.Compact(desConString);
                engine.Dispose();
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.ToString());
                return(false);
            }
            return(true);
        }
Exemple #2
0
 private static SqlCeConnection GetConnection(string path)
 {
     return(new SqlCeConnection(MSSQLCEConn.GetFullConnectionString(path)));
 }