TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
narasiman rao
NA
519
771.8k
how to send mail the excel data from the folder
Aug 25 2016 8:48 AM
My code as follows
SqlConnection sqlConnection = new SqlConnection(connectionstring);
SqlCommand cmd = new SqlCommand();
SqlDataReader reader;
DataSet ds = new DataSet();
cmd.CommandText = "select * from Empdetails";
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlConnection;
sqlConnection.Open();
reader = cmd.ExecuteReader();
if (reader.HasRows)
{
using (System.IO.StreamWriter fileOutput =
new System.IO.StreamWriter(@"C:\Users\God\Desktop\DataDump\Excel.xls"))
{
while (reader.Read())
{
for (int i = 0; i < reader.FieldCount; i++)
{
fileOutput.AutoFlush = true;
fileOutput.Write(reader[i].ToString() +"\t");
}
fileOutput.Write("\n");
}
}
sqlConnection.Close();
}
when i execute the above code select * from Empdetails ouput is saved in the below folder
C:\Users\God\Desktop\DataDump\Excel.xls
i want to send the above excel file to send mail.
for that how can i do in asp.net using c#
What I have tried:
how to send mail the excel data from the folder.
Reply
Answers (
4
)
how to display group inside datagridview
i am sending excel file to my mail