글쓴 사람
        SunNee Dong (clickway at naver.com)
        홈페이지
        
        첨부 파일
        
             
        
        
        
            
            
            
                
                    
                    
                    
                    선생님, 질문 있습니다
string sQuery = "SELECT *FROM Table";
       public bool ExecuteNonQuery(string sQuery)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection("server=20.10.12.71;Database=DB;User ID=user;Password=pw"))
                {
                    conn.Open();
                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection = conn; <====== 1) 에러발생
                    cmd.CommandText = sQuery;
                    cmd.ExecuteNonQuery();
                    conn.Close();<======= 위에 1)에서 에러가 발생하면 conn.Close() 안될거 같음
                }
            }
            catch
            {
               conn.Close(); <======catch문에서 SqlConnection 에서 Close() 해줘야 하는거에요?
                return false;
            }
            finally
            {
            }
            return true;
        }   
        
        
                    
                    
                    
                    
                    
    
                    
                    
                    
                    
                    
                
                    [최초 등록일: ]
                    [최종 수정일: 8/16/2024]