728x90 반응형 C#2 c# 비주얼 스튜디오 SQL server 접속 C#에서 VS2019 로 접속하는 예제에 대한 설명입니다. 접속 예제 using System.Data.SqlClient; namespace ConsoleApp1 { class Program { static void Main(string[] args) { SqlConnection connection; string connectString = string.Format(" Data Source={0},{1};" + "Persist Security Info=false;Integrated Security=false;" + "User ID={2};Password={3};", ip, port, userid, passwd); try { connection = new SqlConnection(connectString);.. 2023. 4. 24. MSSQL C# CLR 라이브러리 SQL 쿼리 C# CLR 라이브러리를 사용하여 SQL 서버에 SQL을 실행 방법을 설명한다. 필요한 헤더 using using Microsoft.SqlServer.Server; // SQL 에서 함수 정의 시 필요. using System.Data.SqlClient; // SQL에 접속에 필요한 Client 사용 시 필요. 간단한 SQL Select 쿼리 소스 [SqlFunction(DataAccess = DataAccessKind.Read)] public static int getSession() { using (SqlConnection conn = new SqlConnection("context connection=true")) { conn.Open(); SqlCommand cmd = new SqlCommand(.. 2021. 12. 2. 이전 1 다음 728x90 반응형