Example #1
0
        private void Save2DB()
        {
            ODMSource odm = new ODMSource();
            string    msg = "";

            odm.Open(@"F:\System\Database\Pearl River Basin.mdb", ref msg);
            var          sites            = odm.GetSites("select * from Sites");
            StreamReader sr               = new StreamReader(Filename);
            Dictionary <string, Site> dic = new Dictionary <string, Site>();

            foreach (var ss in sites)
            {
                dic.Add(ss.Name, ss);
            }
            var line = sr.ReadLine();

            line = sr.ReadLine();
            var varid = TypeConverterEx.SkipSplit <int>(line, 6);

            while (!sr.EndOfStream)
            {
                line = sr.ReadLine();
                var buf = TypeConverterEx.Split <string>(line, TypeConverterEx.Comma);
                for (int i = 0; i < varid.Length; i++)
                {
                    odm.SaveDataValue(dic[buf[1].Trim()], varid[i], DateTime.Parse(buf[2].Trim()), double.Parse(buf[6 + i].Trim()));
                }
            }
            odm.UpdateSeriesCatalog();
            sr.Close();
            odm.Close();
        }
 private void btnUpdateSeriesCata_Click(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     _ODM.UpdateSeriesCatalog();
     Cursor.Current = Cursors.Default;
 }