Hi All

I have a table (contactDetails) in my database (Sql express) with username,password, email, contactNo, bySMS and byEmail columns. I have 2 radiobuttons in my application smsRB and EmailRB, when the user registers he must select either smsRb or EmailRB. if smsRB is selected, a "Y" is inserted under bySMS column in that user's record, else if EmailRB is selected a "Y" is inserted under byEmail column in that user's record. I have another webform where I upload files in a database:

my challenge is: Everytime I upload a file I want my application to send an SMS notification to all the user who chose the smsRB when they registered and send an email notification to all the users who chose EmailRB.

Please help me achieve this task. let me know if its not clear. (using C# 2005)
Thanks

just do a search on google for how to send email via c#, you should find tons of samples

as for the SMS, it kind of depends
easiest way would be to collect phone number and carrier for each user and send it via SMTP
[phonenumber]@[carrierSMTPgateway]
again, you should be able to get a listing of the bigger carriers gateways via a google search

if you don't want to send text messages via SMTP like that, it costs more and/or you need some hardware

Thanks for the reply

what I need is one C# statement for this:

foreach emailAdd where byEmail = Y

emailAdd and byEmail are columns in a Database table.

if I can get this statement I am sure i can work it out from there. I dont need the email/sms code.

ok, then are you loading the data from the database into a datatable object?
an array of datarow objects?
dataset object?

Get the data from the database with a new statement:
select byEmail from ContactDetails where byEmail = 'Y'

Then in c#:
foreach(DataRow row in YourDataSet.Tables["YourTable"].Rows)
sendYourEmailTo( row["byEmail"].ToString() );

Or if you already have the dataset loaded...
DataRow[] emailers = YourDataSet.Tables["YourTable"].Select("byEmail = 'Y'");
foreach(DataRow row in emailers)
sendYourEmailTo( row["byEmail"].ToString() );

Or if using an SqlDataReader...
SqlConnection conn = new SqlConnection( YourConnectionString );
SqlCommand cmd = new SqlCommand("select byEmail from ContactDetails where byEmail = 'Y'",conn);
conn.Open();
SqlDataReader row = cmd.ExecuteReader();
while (row.Read())
{
sendYourEmailTo( row["byEmail"].ToString() );
}
conn.Close();

// Jerry
PS: Just typed off the top of my head, so verify syntax before use.

This question has already been answered. Start a new discussion instead.