question

Harsha24 avatar image
Harsha24 asked

How can i send Email carrying an attachment from datagridview??

I have a table in my database namely EmpAttendance. This table has some columns likely empid,c_Date,intime,outtime,status. How can is send these details as an attachment via email for every half an hour(i have created a windows application in c#). also how can i calculate difference between outtime AND INTIME.
sql-server-2008c#
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
KenJ avatar image
KenJ answered
You can calculate the difference between `outtime` and `intime` using the `datediff` function. For the email, do you want your C# application to send the email? If so, that's a bit off topic and I would refer you to stackoverflow.com (maybe [this question][1]). If you want to send the email from SQL Server, you can set up a SQL Agent job that executes `sp_send_dbmail` - [ http://msdn.microsoft.com/en-us/library/ms190307.aspx][3] [1]: http://stackoverflow.com/questions/4379532/asp-net-c-sharp-converting-data-in-a-dataset-into-body-of-an-email [2]: http://stackoverflow.com/questions/4379532/asp-net-c-sharp-converting-data-in-a-dataset-into-body-of-an-email [3]: http://msdn.microsoft.com/en-us/library/ms190307.aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.