Click here to Skip to main content
15,884,592 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I want to use array to get the contacts' email so that I can send out the email as mass amount.
& I need to also use delimiters to separate each of the emails with a semi-colon ;
after that i need to use join them back again as a string to store it into a textbox.
I have no idea how the codes look like.

Is there any tutorials or steps to follow so that I can learn how to use array and delimiters?

I am new to codings, so urgent help is needed. Thanks
Posted

As I understand from the question, it is required to store the emailIds in an array and then it is required to build a string with those emailIds using ; as delimiter. If it is so, then the following code can be used.
C#
string[] emailIds = new string[] {"id1@abc.com", "id2@def.com", "name1@xyz.org"};
string emailIdsString = string.Join("; ", emailIds);
Console.WriteLine (emailIdsString);

//id1@abc.com; id2@def.com; name1@xyz.org
 
Share this answer
 
Comments
Maciej Los 7-Jun-12 13:44pm    
+5!
VJ Reddy 7-Jun-12 13:47pm    
Thank you, losmac :)
Fiona Tan 7-Jun-12 13:49pm    
It is not emailIds.
As i will be using SQL statements to select the "email" column from Customers table.

Which apparently my SQL statement being inserted to the button to call it also gives me an error.

Here is my SQL select statement :

SELECT Email
FROM Customer
WHERE newsletterAgree = "True"
Maciej Los 7-Jun-12 14:56pm    
SELECT Email FROM Customer WHERE newsletterAgree = 'True'
Use a ' instead of "
See my answer, to your comment.
codeBegin 8-Jun-12 2:18am    
good one 5!
SQL Server does not know BOOLEAN data type. See availible DataTypes[^] for MS SQL Server. BOOLEAN is a text!
So... If you would like to get emails where newsletterAgree is set to "TRUE", use this query:
SQL
SELECT Email
FROM Customer
WHERE newsletterAgree = 'True'

I recomend you to change the data type for newsletterAgree field for int, where
0 = False
and
-1 = TRUE
 
Share this answer
 
Comments
Sandeep Mewara 7-Jun-12 16:21pm    
5!
Maciej Los 7-Jun-12 16:27pm    
Thank you, Sandeep ;)
VJ Reddy 7-Jun-12 20:20pm    
Good answer and suggestion. 5!
Maciej Los 8-Jun-12 6:50am    
Thank you, VJ ;)
codeBegin 8-Jun-12 2:18am    
good one 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900