0
데이터 셋과 테이블 어댑터의 차이점은 누군가가 흥미로운 예를 들어 설명해주십시오.데이터 집합 대 테이블 어댑터?
테이블 어댑터는 SQL Server에서 데이터를 어떻게 가져 옵니까?
데이터 셋과 테이블 어댑터의 차이점은 누군가가 흥미로운 예를 들어 설명해주십시오.데이터 집합 대 테이블 어댑터?
테이블 어댑터는 SQL Server에서 데이터를 어떻게 가져 옵니까?
DataAdapter
을 사용하여 DataSet
을 SqlServer의 데이터로 채 웁니다.
SqlConnection conn = new SqlConnection(connString);
SqlCommand cmd = new SqlCommand("SELECT * FROM tbl_tblname", conn);
try
{
conn.Open();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd; // Set the select command for the DataAdapter
da.Fill(ds); // Fill the DataSet with the DataAdapter
DataGridView1.DataSource = ds.Tables[0]; // I just displayed the results in a grid view for simplicity. If Asp.Net you will have to call a DataBind of course.
catch (Exception ex)
{
conn.Close();
conn.Dispose();
}
테이블 [0]은 (는) 예상 한대로 tbl_tblname이 아닐 수도 있습니다. –
이 사이트는 너무 애매하고 너무 광범위합니다. 자습서를 찾아야합니다. –
어떤 종류의 자습서 – Mathematics
'TableAdapter'는 select, insert, update 및 delete 명령을 보유하는'DataAdapter'를 보유하고있는 견고한 유형의 클래스입니다. 따라서이를 사용하여 강력한 형식의 DataTable/DataSet을 채우거나 데이터를 업데이트 할 수 있습니다. http://msdn.microsoft.com/en-us/library/bz9tthwx.aspx –