Solved

VB.Net - How to Work With Array Contents

Posted on 2014-02-19
2
278 Views
Last Modified: 2014-02-19
Good Day Experts!

I am trying to figure out the best way to iterate through an Array, manipulate the data and then either save it in place or to a new Array.

I have parsed off the string of a Delete query after the Where.  So, for example I would have "Customer = '123' And Order = 'abc'"

Then I run the following code to split it apart on the And:
                    Dim ValueArray() As String
                    ValueArray = qryString.Split(":")

The Array contains:
                     Customer = '123'
                     Order = 'abc'  

I am intersted in stripping off all data before/including the = and getting rid of the single quotes leaving:
                      123
                      abc

I would then need the data back in the original array or a new one.

What is the best way you all can suggest to achieve this?

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 39871059
Try something like:
        Dim qryString As String = "Customer = '123' And Order = 'abc'"
        Dim ValueArray() As String = qryString.Split("And")
        For i As Integer = 0 To ValueArray.Length - 1
            If ValueArray(i).IndexOf("=") <> -1 Then
                ValueArray(i) = ValueArray(i).Split("=")(1).Trim
            End If
            ValueArray(i) = ValueArray(i).Trim("'")
            Debug.Print(i & " = " & ValueArray(i))
        Next

Open in new window

0
 

Author Comment

by:Jimbo99999
ID: 39871596
Thanks for the help...it works great! I like the split on = I didn't think of that.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question