コード例 #1
0
        private SqlTableColumn[] GetSqlTable(SqlCommand command)
        {
            var reader     = command.ExecuteReader();
            var fieldCount = reader.FieldCount;

            reader.Close();
            SqlTableColumn[] sqlTable = new SqlTableColumn[fieldCount];
            for (int i = 0; i < fieldCount; i++)
            {
                reader      = command.ExecuteReader();
                sqlTable[i] = new SqlTableColumn(reader.GetName(i));
                while (reader.Read())
                {
                    sqlTable[i].values.Add(reader.GetValue(i));
                }
                reader.Close();
            }

            return(sqlTable);
        }
コード例 #2
0
ファイル: DataAccess.cs プロジェクト: AHTOH2001/Isp_3_term
        private async Task <SqlTableColumn[]> GetSqlTableAsync(SqlCommand command)
        {
            var reader = await command.ExecuteReaderAsync();

            var fieldCount = reader.FieldCount;

            reader.Close();
            SqlTableColumn[] sqlTable = new SqlTableColumn[fieldCount];
            for (int i = 0; i < fieldCount; i++)
            {
                reader = await command.ExecuteReaderAsync();

                sqlTable[i] = new SqlTableColumn(reader.GetName(i));
                while (await reader.ReadAsync())
                {
                    sqlTable[i].values.Add(reader.GetValue(i));
                }
                reader.Close();
            }

            return(sqlTable);
        }