コード例 #1
0
ファイル: OSQLite.cs プロジェクト: Raxo94/QCView
        private CStringer ExecuteReaderC(string connection, string query)
        {
            DataTable dt = new DataTable();
            CStringer result = new CStringer();
            try
            {
                SQLiteConnection cnn = new SQLiteConnection(connection);
                cnn.Open();
                SQLiteCommand mycommand = new SQLiteCommand(query, cnn);
                SQLiteDataReader reader = mycommand.ExecuteReader();
                dt.Load(reader);
                reader.Close();
                cnn.Close();

                foreach (DataColumn x in dt.Columns)
                    foreach (DataRow row in dt.Rows)
                        if ((row[x.ColumnName] != System.DBNull.Value))
                            result.Add((string)row[x.ColumnName].ToString());

            }
            catch (SQLiteException e) { MessageBox.Show(e.Message); }
            return result;
        }
コード例 #2
0
ファイル: CConfig.cs プロジェクト: Raxo94/QCView
        public CStringer ReadStringer()
        {
            CStringer result = new CStringer();

            XmlReaderSettings xmlsettings = new XmlReaderSettings();
            xmlsettings.ConformanceLevel = ConformanceLevel.Fragment;
            xmlsettings.IgnoreWhitespace = true;
            xmlsettings.IgnoreComments = true;
            XmlNode xNode;
            XmlDocument xmlDoc = new XmlDocument();
            try
            {
                XmlReader reader = XmlReader.Create(xmlPath + xmlfilename, xmlsettings);
                xmlDoc.Load(reader);
                reader.Close();
            }
            catch (XmlException xe) { LogException(xe.Message); }

            xNode = xmlDoc.SelectSingleNode("Config");
            foreach (XmlNode x in xNode.ChildNodes)
                result.Add(x.InnerText);

            return result;
        }