private void GetListBySql(string sql, ValueItemList resultItems)
    {
        CheckConnection();
        SqlDataAdapter resultDA = new SqlDataAdapter(sql, DbConnection);

        DataSet tempDS = new DataSet();

        resultDA.Fill(tempDS, "Result");

        StringWriter strWriter = new StringWriter();

        tempDS.WriteXml(strWriter);
        resultItems.LoadFromXml(strWriter.ToString());
    }
Пример #2
0
        private void GetSqlList(string sql, ValueItemList items)
        {
            CheckConnection();
            var resultDA = new SqlDataAdapter(sql, _connection);

            DataSet tempDS = new DataSet();

            try {
                resultDA.Fill(tempDS, "Result");

                StringWriter strWriter = new StringWriter();
                tempDS.WriteXml(strWriter);
                items.LoadFromXml(strWriter.ToString());
            }
            catch (Exception) {
                items.Clear();
            }
        }