Avatar of Robb Hill
Robb HillFlag for United States of America

asked on 

data table questions

I have a array of datarows that sometimes has length and sometimes has 0 lenght.  Do you see anything in this code segment that would make this aarray get set to 0.  Whats strange is it works sometimes and sometimes it doesnt.

Private Sub Focus(ByVal field As String, ByVal criteria As String)
                Dim expression As String
                Dim criterias As String()
                If InStr(field, "Date") Then
                    criterias = criteria.Split(",")
                    expression = field & " >= #" & criterias(0) & "#" & " AND " & field & " <= #" & criterias(1) & "#"
                Else
                    expression = field & " IN (" & criteria & ")"
                End If
                Dim adrEdit() As DataRow = dt.Select(expression)
                If UBound(adrEdit, 1) > -1 Then
                    Dim cdt As New DataTable
                    cdt = dt.Clone
                    For Each dr As DataRow In adrEdit
                        Dim cdr As DataRow
                        cdr = cdt.NewRow
                        For i As Int16 = 0 To dt.Columns.Count - 1
                            cdr(i) = dr(i)
                        Next
                        cdt.Rows.Add(cdr)
                    Next
                    dt = cdt.Copy
                Else
                    dt.Clear()
                End If
            End Sub
.NET ProgrammingEditors IDEs

Avatar of undefined
Last Comment
Robb Hill
ASKER CERTIFIED SOLUTION
Avatar of igor_alpha
igor_alpha

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Robb Hill
Robb Hill
Flag of United States of America image

ASKER

Actually I got an answer on this...my date conversion was wrong which was pulling back the wrong type of row data...thank you though
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo