asp.net.ph

DataTable.CaseSensitive Property

System.Data Namespace   DataTable Class


Indicates whether string comparisons within the table are case-sensitive.

Syntax


Script DataTable.CaseSensitive [ = true | false ]

Property Value

This property accepts or returns only a boolean value: true if the comparison is case-sensitive; otherwise, false.

The property is read/write with a default value set to the parent DataSet object's CaseSensitive property, or false if the DataTable was created independently of a DataSet.

Remarks

The CaseSensitive property affects string comparisons in sorting, searching, and filtering.

Example

The following example calls the Select method twice on a DataTable. The first time, the CaseSensitive property is set to true, the second, to false.

Private void CaseSensitiveDemo ( ) {
   DataTable tbl = ( DataTable ) myDataGrid.DataSource;
   tbl.CaseSensitive = false;
   Response.Write ( "CaseSensitive = False" );

   // presuming the DataTable has a column named 'id'.
   DataRow [ ] foundRows = tbl.Select ( "id = 'abc'" );
   // print out DataRow values. Presumes row 0 contains the value we're looking for.

   for ( int i = 0; i < foundRows.Length; i++ ) {
      Response.Write ( foundRows [ 0 ] [ 0 ] );
  }

   Response.Write ( "CaseSensitive = True" );
   tbl.CaseSensitive = true;
   foundRows = tbl.Select ( "id = 'abc'" );
   for ( int i = 0; i < foundRows.Length; i++ ) {
      Response.Write ( foundRows [ 0 ] [ 0 ] );
   }
}
  C# VB

See Also

DataTable Members   Select Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph