private DataView ExecuteSql(string sqlCommand)
        {
            if (string.IsNullOrEmpty(sqlCommand))
            {
                return(null);
            }

            if (SqlQuery.SQLContext.MetadataProvider == null)
            {
                return(null);
            }

            if (!SqlQuery.SQLContext.MetadataProvider.Connected)
            {
                SqlQuery.SQLContext.MetadataProvider.Connect();
            }

            try
            {
                DataView table = SqlHelpers.GetDataView(sqlCommand, SqlQuery);
                return(table);
            }
            catch (Exception ex)
            {
                ShowException(ex);
            }

            return(null);
        }
コード例 #2
0
        public void FillData(string resultSql, SQLQuery query)
        {
            try
            {
                ErrorMessage = "";

                var dv = SqlHelpers.GetDataView(resultSql, query);

                ItemsSource = dv;
            }
            catch (Exception exception)
            {
                ErrorMessage = exception.Message;
                ItemsSource  = null;
            }
        }