c# ¿¡¼­ sql ¿¬°áÇÒ ¶§ Æ÷Æ® ¹øÈ£¸¦ ÁöÁ¤ÇÏ·Á¸é ¾îµð´Ù Çϳª¿ä?

¹«¾Æ   
   Á¶È¸ 1840   Ãßõ 0    

아래 코드 처/100; 서버 ip, 디비명, 아1060;디, ǹ16;호 1221;보만 넣고 1217;속Ȣ16;Nj12; 서버1064;데 포트번호를 1648;122116;,172; 해달라lj16;데 포트번호를 1648;122116;/140;면 1217;속 스트링 뒤에 뭘 추가해야 Ȣ16;나요?

단순7176; ";Port=1433"  1060;런 식1004;/196; 문1088;열1012; 뒤에 추가Ȣ16;면 .112;까요?

string connectString = @"Server=" + ip + ";database=" + dbName + ";uid=" + id + ";pwd=" + pw + ";Timeout=3";
using (SqlConnection connection = new SqlConnection(connectString))
{

// 1217;속0143; 기타 코드들

}

...
ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
windfantasia 2022-11
C# ¿¡¼­ SqlConnection°´Ã¼ÀÇ ConnectionStringÀº ±âº»ÀûÀ¸·Î ¾Æ·¡ ±¸Á¶ ÀÔ´Ï´Ù. Ãß°¡ ¿É¼ÇÀº ÀÖÀ» ¼öµµ ÀÖÀ¸³ª. Àú´Â »ç¿ëÇÏÁö ¾Ê½À´Ï´Ù.
Data Source= {IP, PORT} ;Initial Catalog={DB NAME};Persist Security Info=True;User ID={LOGIN ID};Password={LOGIN PASSWORD};Connection Timeout=360
À§ ¹®ÀÚ¿­°ú °°ÀÌ »ç¿ëÇÏ½Ã¸é µË´Ï´Ù.
IP¿Í Æ÷Æ®´Â ½°Ç¥·Î ±¸ºÐÇϽøéµË´Ï´Ù.
     
¹«¾Æ 2022-11
°¨»çÇÕ´Ï´Ù
          
windfantasia 2022-11
¾Æ ¹°·Ð º»¹®¿¡ Àû¾î ³õÀ¸½Å ¹®ÀÚ¿­¿¡¼­
"Server=" + ip + ";  À̺κÐÀ» "Server=" + ip + "," + port  + ";
À§¿Í °°ÀÌ »ç¿ëÇϼŵµ µÉ°Ì´Ï´Ù.
±è»óÇõ2 2022-11
À­ºÐÀÌ ´äº¯ÇØÁÖ¼ÌÀ¸´Ï ÷¾ðÇÏÀÚ¸é
string connectString = $"Server={ip},{port};database={dbName};uid={id};pwd={pw};Timeout=3";
Çü½ÄÀ¸·Î $ ±âÈ£¸¦ »ç¿ëÇÏ¿© {º¯¼ö¸í}À¸·Î ó¸®ÇÏ½Ã¸é ½ÃÀμºÀÌ ´õ ÁÁ¾ÆÁý´Ï´Ù
windfantasia 2022-11
$ ¹®ÀÚ¿­ º¸°£ ±â´ÉÀÌ C# 6.0 ºÎÅÍ Áö¿øµÈ ¹®¹ýÀ̶ó.
.net 4.6 ºÎÅÍ, °³¹ßÅøÀº Visual Studio 2015 ºÎÅÍ Áö¿øµË´Ï´Ù.
.NET 4.6 ÀÌ»óÀ» ¾²½Ã´õ¶óµµ Visual Stueio 2015 ¹Ì¸¸ ¹öÁ¯ ¾²½Å´Ù¸é ÇØ´ç ¹®¹ý ÄÄÆÄÀÏ ´Ü°è¿¡¼­ Syntax¿À·ù ¹ß»ý ÇÕ´Ï´Ù.

Visual Studio 2015 ÀÌÇÏ ¹öÁ¯Àº C# 6.0 ¹®¹ýÀ¸·Î ÀÛ¼ºÇϸé ÄÄÆÄÀÏ ¿¡·¯ ¹ß»ýÇÕ´Ï´Ù.


QnA
Á¦¸ñPage 338/440
2022-12   2571   ½Ã°ñ³ëÀÎ
2022-12   2409   xMir
2022-12   2692   È­Á¤Å¥»ï
2022-12   3162   dateno1
2022-12   3097   ÇÇÄ«
2022-12   1690   ¸Ó¶óÄ«´Âµ¥
2022-12   1334   Å°¸£È÷È£ÇÁ
2022-12   1785   Çã¿ì´ë
2022-12   1130   ½Ã°ñ³ëÀÎ
2022-12   1985   ¹Ì¸£¸£
2022-12   2064   LevinF
2022-12   1510   Ŭ¶ó¿ìµåǪµù
2022-12   1219   Ŭ¶ó¿ìµåǪµù
2022-12   2160   jkaem
2022-12   2170   developer
2022-12   1341   À¯È£ÁØ
2022-12   1511   ¶¥ÀïÀÌ
2022-12   1052   Çã¿ì´ë
2022-12   1363   ¸·³»ÀÇÇÏ·ç
2022-12   1633   Çã¿ì´ë