첨부 소스 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
0.00MB

▶ Program.cs

using System;
using System.Data.SQLite;

using Dapper;

namespace TestProject
{
    /// <summary>
    /// 프로그램
    /// </summary>
    class Program
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Static
        //////////////////////////////////////////////////////////////////////////////// Private

        #region 프로그램 시작하기 - Main()

        /// <summary>
        /// 프로그램 시작하기
        /// </summary>
        private static void Main()
        {
            string connectionString = $"Data Source={"test.db"};";

            string sql = @"
SELECT * FROM School;
SELECT * FROM Student;
";

            using(SQLiteConnection connection = new SQLiteConnection(connectionString))
            {
                using(var reader = connection.QueryMultiple(sql))
                {
                    var resultEnumerable1 = reader.Read<dynamic>();
                    var resultEnumerable2 = reader.Read<dynamic>();

                    foreach(dynamic result in resultEnumerable1)
                    {
                        Console.WriteLine($"{result.ID}, {result.NAME}");
                    }

                    Console.WriteLine();

                    foreach(dynamic result in resultEnumerable2)
                    {
                        Console.WriteLine($"{result.ID}, {result.NAME}, {result.HEIGHT}");
                    }
                }
            }
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요