13장 ADO.NET 메모리상의 DB 이용하여 주소록 만들기
namespace 주소록 public MainForm() //데이터 베이스 연결문자열 지정 |
SqlCommand cmd = new SqlCommand SqlDataAdapter da = new SqlDataAdapter(cmd); this.dgvAddress.DataSource = ds.Tables[0].DefaultView; if (ds.Tables[0].Rows.Count > 0) |
SqlConnection con = new SqlConnection(connectinonString); SqlCommand cmd = new SqlCommand(); cmd.Parameters.AddWithValue("@Name", txtName.Text); cmd.ExecuteNonQuery() ; //저장 |
MessageBox.Show("백업 완료"); // 종료 private int currentIndex = -1; //셀 클릭하였을 경우 선택한값 텍스트 박스에 표시 if (e.RowIndex < ds.Tables[0].Rows.Count) |
SqlCommand cmd = new SqlCommand(); cmd.Parameters.AddWithValue("@Name", txtName.Text); cmd.ExecuteNonQuery(); MessageBox.Show("수정되었습니다"); //삭제 SqlCommand cmd = new SqlCommand(); |
//이동 DataRow dr; this.dgvAddress.DataSource = ddv; |