.NETGURU
DataTable Index
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngdata' list.


Suzan Ali
-- Moved from [aspngstart] to [aspngdata] by Marcie Jones <Click here to reveal e-mail address> --

Hi All,
how can i Add an index to created datatable inorder to increase the
performance when selecting from the table
dtblSpringNet = New DataTable()
dtblSpringNet.Columns.Add(New DataColumn("Date",
GetType(DateTime)))
dstSpringNet.Tables.Add(dtblSpringNet)
        If dstSpringNet.Tables(1).Select("Date=#" &
drowAppointment("date") & "#").Length = 0 Then
        End If

Thanks,
Suzan

Reply to this message...
 
    
Michael Pizzo

ADO.NET v1.0 does not expose Indexes. However, it does create and use
them both for Primary Keys and for DataViews.

You can take advantage of the indexes created for Primary Keys or
DataViews as follows:

If you are searching on a Primary Key field(s) (or can make the field(s)
you are searching on a Primary Key), the instead of DataTable.Select()
use DataTable.Rows.Find(). Find() will look up a primary key value
using the built index.

If you are doing repeated searches on a particular column or set of
columns, you can create a DataView sorted on those columns, and use
DataView.FindRows() to search for a value within those columns.
DataViews create an index for the sorted columns, and FindRows() uses
that index. Note that, when using a DataView, it is more efficient to
use the constructor that takes the table, filter, sort, and rowversions
all at once. Each time you set the filter, sort, or rowversion
properties the index is recreated, so creating a DataView and setting
these properties individually actually creates the index several times.

HTH,

-Mike

-----Original Message-----
From: Suzan Ali [mailto:Click here to reveal e-mail address]=20
Sent: Tuesday, June 25, 2002 6:10 AM
To: aspngdata
Subject: [aspngdata] DataTable Index

-- Moved from [aspngstart] to [aspngdata] by Marcie Jones
<Click here to reveal e-mail address> --

Hi All,
how can i Add an index to created datatable inorder to increase the
performance when selecting from the table
dtblSpringNet =3D New DataTable()
dtblSpringNet.Columns.Add(New DataColumn("Date",
GetType(DateTime)))
dstSpringNet.Tables.Add(dtblSpringNet)
        If dstSpringNet.Tables(1).Select("Date=3D#" &
drowAppointment("date") & "#").Length =3D 0 Then
        End If

Thanks,
Suzan

| [aspngdata] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspngdata.asp =3D JOIN/QUIT
| http://www.asplists.com/search =3D SEARCH Archives

Reply to this message...
 
 
System.Data.DataColumn
System.Data.DataTable
System.Data.DataView
System.DateTime




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification