By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,704 Members | 1,076 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,704 IT Pros & Developers. It's quick & easy.

Geting error ---object reference not set to an instance---at bold line----plz reply

P: 4
/*Geting error ---object reference not set to an instance---at bold line----plz reply asap thanks in advance*/


cmd = new OleDbCommand ("SELECT e.emp_id,e.email, m.email AS Email FROM emp_details e INNER JOIN emp_details m ON e.spid = m.emp_id AND e.emp_id='" + e_id + "'",conn);
dr=cmd.ExecuteReader();
if(dr.Read())
{
strmail=dr["email"].ToString();
strmailto=dr["Email"].ToString();
}
dr.Close();
MailMessage mail=new MailMessage();
mail.To=strmailto;
mail.From = strmail ;
mail.Subject="Leave Application From";
//mail.Body= Mam & s & txtremak.Text ;
mail.Body=txtremark.Text;
mail.BodyFormat=MailFormat.Html;
mail.Priority = MailPriority.Normal;
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver","localhost");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport","25");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", "2");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate","1");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","abc@abc.com");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword","abc123");
SmtpMail.SmtpServer.Insert(0,"localhost");
SmtpMail.Send(mail);
conn.Close();
Jul 2 '07 #1
Share this Question
Share on Google+
2 Replies


kenobewan
Expert 2.5K+
P: 4,871
I see the problem as being the line before - mail.Body=txtremark.Text;.
Jul 2 '07 #2

P: 4
i did at own... its very easy...
Jul 3 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.