-
C# foreach DataRow in DataSet닷넷/C# 2018. 12. 11. 17:21반응형private void Example(){SqlConnection sqlConnection = new SqlConnection("server=localhost;database=MyDatabase;User ID=uid;Password=pwd;");SqlDataAdapter sqlAdapter = new SqlDataAdapter("SELECT ID, Name, Mobile FROM Users", sqlConnection);DataSet ds = new DataSet();sqlAdapter.Fill(ds, "Users");foreach (DataRow dr in ds.Tables["Users"].Rows){Console.WriteLine(dr["ID"] + "\t" + dr["Name"]+ "\t" + dr["Mobile"]);}}
cs 반응형'닷넷 > C#' 카테고리의 다른 글
C# List<type> 중복제거 (0) 2019.04.14 Tizen C# load local image, res 폴더에 있는 이미지 읽기 (ImageSource.FromFile) (0) 2019.01.03 C# 웹통신 요청 및 응답 (WebRequest POST, WebResponse) (ContentType: application/x-www-form-urlencoded) (0) 2018.11.15 C# 우선순위 큐, Priority queue (0) 2018.11.07 C# JSON POST and GET (정보 전달 및 확인) (0) 2018.11.02