Welcome Guest!
Please login
If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:
- Receive Fast Advice
- Learn Programming Languages
- Get Professional Website Reviews
- Quick Troubleshooting Assistance
Using String.join()
This is a discussion on Using String.join(), within the ASP/.NET section. This forum and the thread "Using String.join()" are both part of the Programming Your Website category.
![]() ![]() |
May 9 2008, 12:20 PM
Post
#1
|
|
![]() Co-Founder ![]() ![]() ![]() ![]() ![]() ![]() Group: Co-Founders Posts: 2,470 Joined: 13-February 08 From: Squeezin' Member No.: 2 |
I'm trying to use the String.Join() to get an array to form 1 string
CODE Dim arrSite As String = {"Hello", "BUILDING_NAME", "BUILDING_UNIT_IDENTIFIER", "DLVRY_INSTLTN_QUALIFIER_NAME", _ "ROUTE_SERVICE_NUMBER", "POSTAL_BOX_NUMBER", "STREET_NUMBER"} strDisplayMember = String.Join(" ", CType(arrSite, String())) But I get a blue squigly line under arrSite saying "Array initializers are valid only for arrays, but the type of 'arrSite' is 'String'" Ok so .. if I change that to dim arrSite As Array, I still get a squigly line and it says "Array initializers are valid only for arrays, but the type of 'arrSite' is 'System.Array'" ?!? -------------------- The Squeeze Store is now OPEN! Come on in and grab something!
a web design portfolio | web non-sense I'm also on: del.icio.us | flickr | virb | facebook | twitter The Web Squeeze is also on: virb | facebook | stumbleupon - JOIN IN! |
|
|
May 9 2008, 01:30 PM
Post
#2
|
|
![]() Co-Founder ![]() ![]() ![]() ![]() ![]() ![]() Group: Co-Founders Posts: 2,470 Joined: 13-February 08 From: Squeezin' Member No.: 2 |
Bah... I forgot to put
Dim arrSite(10) As String -------------------- The Squeeze Store is now OPEN! Come on in and grab something!
a web design portfolio | web non-sense I'm also on: del.icio.us | flickr | virb | facebook | twitter The Web Squeeze is also on: virb | facebook | stumbleupon - JOIN IN! |
|
|
May 9 2008, 01:32 PM
Post
#3
|
|
|
Rapid Squeezer ![]() ![]() ![]() ![]() Group: Members Posts: 222 Joined: 15-February 08 From: Finland Member No.: 139 |
Oh my how odd VB looks after six months with C#
CODE Dim arrSite() As String
arrSite = new String() {"Hello", "BUILDING_NAME", "BUILDING_UNIT_IDENTIFIER", "DLVRY_INSTLTN_QUALIFIER_NAME", _ "ROUTE_SERVICE_NUMBER", "POSTAL_BOX_NUMBER", "STREET_NUMBER"} -------------------- anttisimonen.com - .NET developer
anttis.wordpress.com - Blog |
|
|
May 9 2008, 01:33 PM
Post
#4
|
|
|
Rapid Squeezer ![]() ![]() ![]() ![]() Group: Members Posts: 222 Joined: 15-February 08 From: Finland Member No.: 139 |
Oh, you were faster than me
-------------------- anttisimonen.com - .NET developer
anttis.wordpress.com - Blog |
|
|
May 9 2008, 02:03 PM
Post
#5
|
|
![]() Co-Founder ![]() ![]() ![]() ![]() ![]() ![]() Group: Co-Founders Posts: 2,470 Joined: 13-February 08 From: Squeezin' Member No.: 2 |
Is there something else that basically does the same thing?!
Thing is I have all this data in a datatable (taken from the DB) and I just want to take certain fields from there and put in a string. Sort of the opposite of Trim()? -------------------- The Squeeze Store is now OPEN! Come on in and grab something!
a web design portfolio | web non-sense I'm also on: del.icio.us | flickr | virb | facebook | twitter The Web Squeeze is also on: virb | facebook | stumbleupon - JOIN IN! |
|
|
May 9 2008, 02:36 PM
Post
#6
|
|
|
Rapid Squeezer ![]() ![]() ![]() ![]() Group: Members Posts: 222 Joined: 15-February 08 From: Finland Member No.: 139 |
If I understood you correctly, you have a database and you query it to get some stuff and then you want to assign those for string variables? If that's the case, DataReader is one possibility. Nowadays I usually just place the data in strongly typed dataset and then get what I need from there.
-------------------- anttisimonen.com - .NET developer
anttis.wordpress.com - Blog |
|
|
May 9 2008, 08:45 PM
Post
#7
|
|
![]() Co-Founder ![]() ![]() ![]() ![]() ![]() ![]() Group: Co-Founders Posts: 2,470 Joined: 13-February 08 From: Squeezin' Member No.: 2 |
I have stuff in a db, then i query it and put it a datatable. From there, I want to be able to take certain fields in one row and concatenate it into a string. I don't have the stuff with me ... it's work stuff so I'll have to wait 'til monday
-------------------- The Squeeze Store is now OPEN! Come on in and grab something!
a web design portfolio | web non-sense I'm also on: del.icio.us | flickr | virb | facebook | twitter The Web Squeeze is also on: virb | facebook | stumbleupon - JOIN IN! |
|
|
May 10 2008, 01:40 AM
Post
#8
|
|
|
Rapid Squeezer ![]() ![]() ![]() ![]() Group: Members Posts: 222 Joined: 15-February 08 From: Finland Member No.: 139 |
Then the datareader or dataset approach works fine. Dataset approach is a bit more work but has its advantages in the end. You can use datareader for now.
-------------------- anttisimonen.com - .NET developer
anttis.wordpress.com - Blog |
|
|
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
3 | Marc | 62 | 8th April 2008 - 08:48 AM Last post by: Marc |
|||
![]() |
1 | paintingtheweb | 122 | 15th April 2008 - 03:19 PM Last post by: Rakuli |
|||
![]() |
9 | unitedcraig | 152 | 11th June 2008 - 02:18 AM Last post by: unitedcraig |
|||






May 9 2008, 12:20 PM






