erm1sh
Kilopat
Daha fazla
- Cinsiyet
- Erkek
- Meslek
- Öğrenci
Kodlarımda çözemediğim bir hata sonucu "Satır/sütun hiç veri yok." hatası alıyorum.
Not: baglantiVerileri, bir sınıf.
C#:
private void button1_Click(object sender, EventArgs e)
{
con.Open();
OleDbCommand com = new OleDbCommand("Select * FROM Uyeler where uEposta = @p1 and uSifre = @p2 ",con);
com.Parameters.AddWithValue("p1", baglantiVerileri.kullaniciEmail);
com.Parameters.AddWithValue("p2", textBoxSifre.Text);
dr = com.ExecuteReader();
if (dr.Read()) //Burayı okumadan else'ye atlıyor.
{
MailMessage ePosta = new MailMessage();
SmtpClient smtp = new SmtpClient();
ePosta.From = new MailAddress(baglantiVerileri.kullaniciEmail);
ePosta.To.Add(textBoxKime.Text);
/* ePosta.Attachments.Add(new Attachment(openFileDialog1.FileName));*/
ePosta.Subject = textBoxKonu.Text;
ePosta.Body = richTextBoxAciklama.Text;
smtp.Credentials = new System.Net.NetworkCredential(baglantiVerileri.kullaniciEmail, baglantiVerileri.kullaniciSifre);
smtp.Port = 587;
smtp.Host = baglantiVerileri.smtpHost;
smtp.EnableSsl = true;
smtp.Send(ePosta);
MessageBox.Show("Mail başarı ile gönderildi!", "Başarılı!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else if (baglantiVerileri.kullaniciEmail != dr["uEposta"].ToString()) //Burada "Satır/sütun hiç veri yok." hatasını alıyorum.
{
MessageBox.Show("E-posta adresiniz, veritabanımızdaki verilerle uyuşmamaktadır. Lütfen bilgilerinizi kontrol ediniz.", "Hata!", MessageBoxButtons.OK, MessageBoxIcon.Error);
textBoxKime.Focus();
}
con.Close();
}