Hi Guys!
I realize this is a question I could answer myself with some testing but wanted your opinions.
I am looking to see if a certain row exists in a dataset (2000+rows). I have two methods.
1) Brute Force
VB Code:
For iRow = 0 To objTblMaillist.Rows.Count - 1 Step 1 If Not (objTblMaillist.Rows(iRow).Item(0) Is GetType(System.DBNull)) Then If CStr(objTblMaillist.Rows(iRow).Item(0)) = sShortCode Then bFound = True Exit For End If End If Next iRow
vs
2) Framework
VB Code:
objTblMaillist.PrimaryKey = New System.Data.DataColumn() {objTblMaillist.Columns(0)} objTblMaillist.DefaultView.Sort = "Source" If objTblMaillist.DefaultView.Find(sShortCode) >= 0 Then bFound = True End If
So what do think would be quicker?
Thanks,
Matt




Reply With Quote