コード例 #1
0
        public DataTable GetDataTable(string commandText, CommandType commandType)
        {
            var connection = GetDatabaseConnection();

            using (var command = database.CreateCommand(commandText, commandType, connection))
            {
                if (parameters.Count > 0)
                {
                    Parallel.ForEach(parameters, (parameter) =>
                    {
                        command.Parameters.Add(parameter);
                    });
                }

                var dataset    = new DataSet();
                var dataAdaper = database.CreateAdapter();
                dataAdaper.Fill(dataset);
                return(dataset.Tables[0]);
            }
        }