Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Vb.net array

Posted on 2014-03-10
2
Medium Priority
?
413 Views
Last Modified: 2014-03-10
I need declare an array something like this:
Dim arrayV() As String = {"Monitor", "DC Adapter", "Bag","Option1","Option2"}

But would like to store the contents of array in database field and then go get your content:

Database field content: "Monitor", "DC Adapter", "Bag","Option1","Option2"

And would get the contents of the field containing the array:

Dim ArrayV() as string={Database field content}

How can do
0
Comment
Question by:rflorencio
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 1600 total points
ID: 39917300
Assuming you are storing your values in a delimited format, you just need to use String.Split("<your delimiter>") to pull the values into an array:
'// Database access code

...

Dim arr() As String = SomeDataReader.GetString(0).Split("<your_delimiter>")

...

Open in new window

0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 400 total points
ID: 39917309
just a note:
"Monitor", "DC Adapter", "Bag","Option1","Option2"

from the db should then be without all the quotes:
Monitor,DC Adapter,Bag,Option1,Option2
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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 response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

963 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