Right now I have a Select Tag retrieving all the Title of the documents from the Database:
string QueryString = "SELECT TITLE FROM DOC";
SqlConnection myconnection = new SqlConnection(ConnectString);
SqlDataAdapter mycommand = new SqlDataAdapter(QueryString,myconnection);
DataSet ds = new DataSet();
mycommand.Fill(ds, "DOC");
test.DataSource = ds;
test.DataTextField = "TITLE";
test.DataValueField = "TITLE";
test.DataBind();
The problem is that I need to store all this data in text so that I can use the MailMessage Class and send it via Email.
Any Thoughts?
You can convert DataSet to list
var titleList = ds.Tables[0].AsEnumerable()
.Select(dr => new {Name = dr.Field<string>("TITLE")}).ToList();
Then you can concatenate it into single string:
var titles = titleList.Aggregate((current, next) => current + ", " + next);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With