DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 16 Aug 2007 07:39:27 -0700,    posted on: microsoft.public.dotnet.framework.compactframework        back       

Thread Index
  1    Chuck Hecht


Dataset with Primary key   
I am creating a datatable from a xml file, the datatable contains 4 fields, type, name, desc and uniquecode. This table could have 8000-10000 records. 
dsTraker.Tables("slookups").ReadXmlSchema("\my documents\slookups.xsd")

dsTraker.Tables("slookups").ReadXml("\my documents\slookups.xml")

I have created a primary key as follows (the xml file is created from a Visual foxpro database and there is no key for this table)

Dim pk(1) As DataColumn

pk(0) = dsTraker.Tables("slookups").Columns("type")

pk(1) = dsTraker.Tables("slookups").Columns("name")

dsTraker.Tables("slookups").PrimaryKey = pk

I need to find a value (glocation) in the slookups table that is scanned into my program.

Public Function VerifyLocation(ByVal glocation As String) As Boolean

Dim dvlookups As DataView

Dim RowFoundIndex As Integer

Dim sql As String

glocation = Trim(glocation)

sql = "Name = " & glocation


dvlookups = New DataView(dsTraker.Tables("slookups"))

dvlookups.Sort = "name"

dvlookups.RowFilter = sql

dvlookups.RowStateFilter = DataViewRowState.CurrentRows

RowFoundIndex = dvlookups.Find(glocation)

If RowFoundIndex = -1 Then

Else

VerifyLocation = True

End If

End Function

Question 1: Since I created the index on dsTraker.Tables("slookups") should that not be inherited my the dataview that I create in the VerifyLocation function?

Question 2: If question 1 above is yes then will the dataview use that key in the find method 

I ask these questions because the time it takes to run this is around 20-40 seconds for each find. Any help is appreicated

chuck
Date:Thu, 16 Aug 2007 07:39:27 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us