ADO.NET 관련 클래스 SqlConnection : SQL Server 데이터베이스에 대한 열린 연결을 나타낸다. SqlCommand : SQL Server 데이터베이스에 대해 실행할 Transact-SQL 문이나 저장 프로시저를 나타낸다. SqlDataReader : SQL Server 데이터베이스에서 행의 앞으로만 이동 가능한 스트림을 읽을 수 있게 한다. SqlDataAdapter : DataSet를 채우고 SQL Server 데이터베이스를 업데이트하는 데 사용할 데이터 명령 집합과 데이터베이스 연결을 나타낸다. DataSet : 메모리 내의 데이터 캐시를 나타낸다. DataTable : 메모리에 있는 데이터로 구성된 하나의 테이블을 나타낸다. DataView : 정렬, 필터링, 검색, 편집 및..
Form1.Designer.cs private System.Windows.Forms.ListBox listBox1; AddressBook.cs [ Class 파일 추가 ] Linq를 사용하기 위해 참조추가를 합니다. namespace WinLinqToSQL { /// /// AddressBook 테이블과 일대일 매칭되는 클래스 /// [Table(Name="AddressBook")] // Table 특성 사용해서 테이블로 보자 public class AddressBook { private int _Num; [Column(IsPrimaryKey=true, Storage="_Num")] public int Num // Num 속성은 Num 컬럼과 매칭, 기본키 설정 { get { return _Num; } ..
Linq를 이용한 DataSet 입니다. Form1.Designer.cs private System.Windows.Forms.ListBox listBox1; private System.Windows.Forms.ListBox listBox2; private System.Windows.Forms.ListBox listBox3; Form1.cs namespace WinLinqToDataSet { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection( "server..
바인딩(Binding) : 데이터 소스를 폼의 컨트롤과 연결하여 폼에 DB의 내용을 출력하는 기법 컨트롤과 DB과 연결되어 양방향으로 데이터가 오고 가는 것 DataBinding : 컨트롤에 대한 데이터 바인딩을 가져옴 Form1.Designer.cs private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextB..
SqlCommandBuilder : 연결된 SQL Server 데이터베이스에서 DataSet의 변경 내용을 조정하는데 사용되는 단일 테이블 명령을 자동으로 생성. 이 클래스는 상속될 수 없음 SqlDataAdapter는 SQL Server의 관련 인스턴스를 사용하여 DataSet의 변경을 조정하는 데 필요한 T-SQL문을 자동으로 생성. 그 러나 SqlDataAdapter의 SelectCommand속성을 설정하면, SqlCommandBuilder 개체를 만들어 단일 테이블 업데이트를 위한 T-SQL문을 자동으로 생성 가능. 그런 다음 설정하지 않은 추가 T-SQL문이 SqlCommandBuilder에 의해 생성 데이터 베이스 추가 Create Table AddressBook ( Num int identi..
DataAdapter : DataSet을 체우고 데이터 소스를 업데이트 하는데 사용되는 SQL 명령 집합 및 데이터 베이스 연결 Form1.Designer.cs private System.Windows.Forms.DataGridView dataGridView1; private System.Windows.Forms.DataGridView dataGridView2; private System.Windows.Forms.Button btnSave; Form1.cs namespace DataAdapter { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender,..
WinForm 에서 ADO ConnectionString문자열 연결하여 DB에 값을 입력/출력/수정/삭제 하는 예제입니다. Form1.Designer.cs private System.Windows.Forms.ListBox listBox1; private System.Windows.Forms.Button btnSelect; private System.Windows.Forms.Button btUpdate; private System.Windows.Forms.Button btnDelete; private System.Windows.Forms.Button btnSum; private System.Windows.Forms.TextBox txtCategoryName; private System.Windows.For..
윈 폼에서 ADO를 연결 상태를 확인 하는 예제입니다. Form1.Designer.cs private System.Windows.Forms.ListBox listBox1; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; Form1.cs public partial class Form1 : Form { private SqlConnection Con; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { Con = new SqlConnection(); Con.ConnectionStr..
Form을 이용한 DataSet 예제입니다. 결과화면
리스트로 출력하는 예제입니다. FrmDataTableSelect.aspx FrmDataTableSelect.aspx.cs protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DisplayData(); } } private void DisplayData() { SqlConnection con = new SqlConnection( ConfigurationManager .ConnectionStrings["ConnectionString"].ConnectionString); SqlCommand cmd = new SqlCommand( "Select Num, CategoryName From Categories", con); Sq..
FrmSqlParamter.aspx 카테고리 추가 : FrmSqlParamter.aspx.cs protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DisplayData(); } } private void DisplayData() { SqlConnection con = new SqlConnection( ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); con.Open(); SqlCommand cmd = new SqlCommand("Select * From Categories", con); SqlDataAdapter da = new..
DataView에 표시할 행을 필터링하는 데 사용하는 식을 사져오거나 설정 데이터 검색시 사용하는 속성 : "CategoryName Like '%컴퓨터%'" Connection->Command->DataAdapter->DataSet->DataTable->Dataview->Dataview.RowFilger 속성 FrmRowFilter.aspx 카테고리명 : FrmRowFilter.aspx.cs protected void btnSearch_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection( ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);..
DataTable의 데이터 행 DataRow 개체와 DataColumn 개체는 DataTable의 기본 구성 요소 DataRow 개체 및 해당 속성과 메서드를 사용하여 DataTable의 값을 검색, 계산, 삽입, 삭제 및 업데이트 FrmDataRow.aspx 카테고리 리스트 출력 FrmDataRow.aspx.cs protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection( ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); con.Open(); SqlCommand cmd = new SqlCommand("Sele..
Copyright © 2016 by WaaNee. All Rights Reserved.