473,373 Members | 1,394 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,373 software developers and data experts.

sent time incorrect

Hello,
I wrote this program in C# that accesses a SQL Server database that
runs a stored procedure and sents the results in an email every 30min.
I wrote this as a windows application instead of a windows service, so
the application is run every 30min through a scheduled task. When the
email is received the received time is ok, but the sent time is
incorrect. In some emails the sent date/time is the same displaying
that the email was sent yesterday, but the latest one showed it was off
by 9 and a half hours. The date and time on the computer this is
running from is correct as is the exchange server and the computer it's
running on. The network admin said the time is handled by the domain
controller so if the time is off emails would not be sent at all.
Anyone have any ideas as to why this is occuring or how to fix it? Is
there something I need to write in my code to get the sent date/time to
appear correctly? Below is my code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Net.Mail;

namespace Harland_Email_Report
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{

}

private void Form1_Load(object sender, EventArgs e)
{
SqlConnection Conn = new SqlConnection();
{
Conn = new SqlConnection("server=***;user
id=***;password=***;database=***");
Conn.Open();
}

string emailbody = string.Empty;
emailbody = "<table width=599px><tr
align=center><th>Department</th><th># Molds</th><th># Stamps</th><th>#
Rejected</th><th> # Total</th></tr>";

SqlCommand DBCmd = new
SqlCommand("sp_Mold_Header_SEL_ByDepartmentDueDate ", Conn);
DBCmd.CommandType = CommandType.StoredProcedure;

SqlDataReader myDataReader;
myDataReader = DBCmd.ExecuteReader();

while (myDataReader.Read())
{
emailbody = emailbody + "<tr align=center><td>" +
myDataReader["Department"].ToString() + "</td><td>" +
myDataReader["Number of Molds"].ToString() + "</td><td>" +
myDataReader["Number of Stamps"].ToString() + "</td><td>" +
myDataReader["Stamps Rejected"].ToString() + "</td><td>" +
myDataReader["Total Number of Stamps"].ToString() + "</td></tr>";
}

emailbody = emailbody + "</table>";
MailMessage mm = new MailMessage();
mm.To.Add("te**@test.com");
mm.From = new MailAddress("te**@test.com");
mm.Subject = "subject";
mm.BodyEncoding = Encoding.ASCII;
mm.IsBodyHtml = true;
mm.Body = emailbody;
SmtpClient client = new SmtpClient("***");
client.Send(mm);

Conn.Close();

this.Close();

}
}
}

thanks

Nov 28 '05 #1
1 1599
hal
anybody have any ideas?

Nov 29 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Linda Wienholt | last post by:
I have two usercontrols on the home page of my website. They are intermitently sending incorrect HTML to the browser, which results in a textbox being rendered with the wrong width. Either both...
0
by: Tony Castellano | last post by:
I'm using the smtpmail class (Framework 1.0) to send email via an outside server. The code used is pretty straightforward. I declare a MailMessage with a body, a to, from, and an attachment. ...
22
by: Platero | last post by:
Hi, I've a stupid question but... The code is the following: if(($role!='tutor')&&(array_key_exists('tutor_id',$_GET))) { $possible_ids = array(2,6,7,8,9,10); $t_id = $_GET;
15
by: student4lifer | last post by:
Hello, I have 2 time fields dynamically generated in format "m/d/y H:m". Could someone show me a good function to calculate the time interval difference in minutes? I played with strtotime() but...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.