¾È³çÇϼ¼¿ä.
select ¹®À» ¿©·¯ °³ ½ÇÇàÇÏ·Á¸é,
sql º¯¼ö¿¡ 2°³ ÀÌ»óÀÇ Select ¹®À» ³Ö¾î ³õÀº ÈÄ
À̸¦ SqlCommand °³Ã¼¿¡ Àü¼ÛÇÑ ÈÄ
reader.NextResult() ¸Þ¼µå·Î ´ÙÀ½ ±¸¹®À» ½ÇÇàÇÒ ¼ö ÀÖ½À´Ï´Ù.
¾Æ·¡ ½ºÅÿÀ¹öÇ÷Π»çÀÌÆ®ÀÇ Ã¹¹ø° ¿¹Á¦°¡ Á¤È®ÇÑ ¿¹Á¦°¡ µÇ´Ï
Âü°íÇØ º¸½Ã±â ¹Ù¶ø´Ï´Ù.
https://stackoverflow.com/questions/12715620/how-do-i-return-multiple-result-sets-with-sqlcommand
À§ ³»¿ë Áß
2¹ø° ¿¹Á¦´Â ÀúÀå ÇÁ·Î½ÃÀú¿Í DataSetÀ» »ç¿ëÇÒ ¶§¸¦ º¸¿©ÁÖ°í,
3¹ø° ¿¹Á¦´Â Á¦°¡ ÃÖ±Ù Áñ°Ü »ç¿ëÇÏ´Â Dapper¸¦ »ç¿ëÇÏ¿©
¿©·¯°³ÀÇ Select¹®À» ó¸®ÇÏ´Â ¿¹Á¦ÀÔ´Ï´Ù.
±èÁø¸¸ ´ÔÀÌ ¾²½Å ¿ø¹® ±ÛÀÔ´Ï´Ù.
¾È³çÇϼ¼¿ä °»ç´Ô
Äõ¸®¹®ÀÌ µÎ°³°¡ ÀÖÀ»¶§ ÀÌ µÎ°³¸¦ µ¿½Ã¿¡ »ç¿ëÇÒ ¼ö ÀÖ´ÂÁö¿ä.
¿¹¸¦ µé¾î
strSql1 = "Select * from TableA";
strSql2 = "Select * from TableB"; //µÎ°³ÀÇ Äõ¸®¹®ÀÌ ÀÖÀ»¶§
SqlCommand objCmd = new SqlCommand();
objCmd.Connection = objCon;
objCmd.CommandText = strSql1 ; strSql2;
Çü½ÄÀ¸·Î µÎ°³ÀÇ Äõ¸®¸¦ µ¿½Ã¿¡ »ç¿ëÇÒ ¼ö ÀÖ´Â ¹æ¹ýÀÌ ÀÖ´ÂÁö ±Ã±ÝÇÕ´Ï´Ù.
|