티스토리 툴바


test

분류없음 2009/12/08 15:50
sta
Posted by 동원굴비

using System;

using System.Collections.Generic;

using System.Text;

using System.Data;

using System.Data.SqlClient;



namespace ConsoleConnection

{

    class Program

    {

        static void Main(string[] args)

        {

            SqlConnection conn = new SqlConnection();

            conn.ConnectionString =

                "Server=localhost;database=PROJECT1;uid=kkk123;pwd=1230987;";

            try

            {

                conn.Open();

                Console.WriteLine("데이터베이스 연결 성공...");


            }

            catch

            {

                Console.WriteLine("데이터베이스 연결 실패");

            }

            finally

            {

                if (conn != null)

                {

                    conn.Close();

                }

                Console.WriteLine("데이터베이스 연결 해제");

            }

        }

    }

}

Posted by 동원굴비
TAG C#, mssql
Posted by 동원굴비
TAG 브아걸