1) What Is The Difference Between Data Table And Data

  • Uploaded by: Sumeetha Ponnam
  • 0
  • 0
  • July 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View 1) What Is The Difference Between Data Table And Data as PDF for free.

More details

  • Words: 212
  • Pages: 2
1) What is the difference between Data Table and Data View? 1) Dataview is used to filter and give sorting options that u have u added to form or component at design time. Alternatively u can use defaultview that is automatically Available for every datatable .when u use defaultview, u Can specify filter and sorting options in code 2) Data table contains datarows and datacolumns but dataview Means it will filter data in datatable. 3) Another difference is, DataView can not be serialized, where as DataTable can be serialized. So DataTable can be stored in ViewState but DataView can not.

Example of datatable <@ Import Namespace="System.Data" > <script language="VB" runat="server"> Sub Page_Load(sender as Object, e as EventArgs) If Not Page.IsPostBack then 'Create the DataTable Dim dt as New DataTable() 'Create the columns Dim dcName as New DataColumn("Name", GetType(String)) Dim dcAge as New DataColumn("Age", GetType(Integer)) 'Add the columns to the DataTable's Columns collection dt.Columns.Add(dcName) dt.Columns.Add(dcAge) 'Add some rows Dim dr as DataRow dr = dt.NewRow() dr("Name") = "Scott" dr("Age") = 25 dt.Rows.Add(dr) dr = dt.NewRow() dr("Name") = "Jisun" dr("Age") = 24 dt.Rows.Add(dr) dr = dt.NewRow() dr("Name") = "Sam" dr("Age") = 5 dt.Rows.Add(dr) 'Bind the DataTable to the DataGrid dgPeople.DataSource = dt dgPeople.DataBind()

End If End Sub

Related Documents


More Documents from ""