private bool OpenDatabase(string address) { try { address = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + address + ";"; using (OleDbConnection logdbcon = new OleDbConnection(address)) { logdbcon.Open(); OleDbCommand cmd = new OleDbCommand(@"SELECT * FROM [word]", logdbcon); OleDbDataReader dr = cmd.ExecuteReader(); ThesaurusDict temptd; ms_td = new List <ThesaurusDict>(); while (dr.Read()) { temptd = new ThesaurusDict(); temptd.SrcWord = ((string)dr["src"]); temptd.DstWord = ((string)dr["dst"]); temptd.Probility = ((float)dr["pbl"]); ms_td.Add(temptd); } dr.Close(); return(true); } } catch (Exception e) { log.Debug(e); return(false); } }
private bool OpenDatabase(string address) { try { address = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + address + ";"; using (OleDbConnection logdbcon = new OleDbConnection(address)) { logdbcon.Open(); OleDbCommand cmd = new OleDbCommand(@"SELECT * FROM [word]", logdbcon); OleDbDataReader dr = cmd.ExecuteReader(); ThesaurusDict temptd; ms_td = new List<ThesaurusDict>(); while (dr.Read()) { temptd = new ThesaurusDict(); temptd.SrcWord = ((string)dr["src"]); temptd.DstWord = ((string)dr["dst"]); temptd.Probility = ((float)dr["pbl"]); ms_td.Add(temptd); } dr.Close(); return true; } } catch (Exception e) { log.Debug(e); return false; } }