본문 바로가기

Update

[ADO.NET]DB연동-비연결기반 UPDATE 비연결기반의 UPDATE를 예제를 통해 알아보도록 합시다. protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindDropDownList(); SetInfo(); } } // 페이지 최초 로드시 임의로 작성한 BindDropDownList(), SetInfo() 메서드를 호출합니다. void BindDropDownList() { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TestConnectionString"].ConnectionString); SqlCommand cmd = new SqlCommand("SELECT u.. 더보기
[ADO.NET] DB연결- 연결기반 UPDATE UPDATE UPDATE는 기존 정보를 수정하고자 할 때 사용할 수 있습니다. 많이 들어보신 거죠? protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindDropDownList(); SetInfo(); } } DropDownList를 호출합니다. void BindDropDownList() { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TestConnectionString"].ConnectionString); SqlCommand cmd = new SqlCommand("SELECT user_id FROM Member",.. 더보기
[ADO.NET] DB 연동하기 - 연결기반 INSERT INSERT INSERT는 해석 그대로 삽입하는 것입니다. TextBox에 입력(삽입)한 내용을 저장하는 것이지요. protected void Button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TestConnectionString"].ConnectionString); string strSql = "INSERT INTO Member(user_id, password, name, phone) VALUES('" +TextBox1.Text + "', '" +TextBox2.Text+ "', '" +TextBox3.Text + "', '"+TextB.. 더보기