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
saroj bhattacharya
NA
0
43.2k
how to solved ERROR:-Invalid object name 'Email'.
Jul 17 2015 8:17 AM
i am try to make a email sending application but
there is a error will be occur
the error is bellow
ERROR:-Invalid object name 'Email'.
my code is bellow-
multiplemailsending22.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
using System.Data.SqlClient;
namespace csvfileupload2
{
public partial class multiplemailsending22 : System.Web.UI.Page
{
SqlDataAdapter da;
DataSet ds = new DataSet();
SqlConnection con;
SqlCommand cmd = new SqlCommand();
SqlDataReader read_Email;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btn1_Click(object sender, EventArgs e)
{
ArrayList list_emails = new ArrayList();
int i = 0;
string email;
string str = "Data Source=ANIRUDDHA-PC;Initial Catalog=sark;Integrated Security=True";
con = new SqlConnection(str);
con.Open();
SqlCommand cmd = new SqlCommand("Select email from Email", con);
SqlDataReader read_Email = cmd.ExecuteReader();
while (read_Email.Read())
{
email = read_Email.GetValue(i).ToString();
list_emails.Add(email); //Add email to a arraylist
i = i + 1 - 1;
}
read_Email.Close();
con.Close(); //Close connection
foreach (string email_to in list_emails)
{
MailMessage mail = new MailMessage();
Attachment attach = new Attachment(fileAttachement.PostedFile.FileName);
mail.To.Add(email_to);
mail.From = new MailAddress("
[email protected]
");
string Bcc = txtBcc.Text;
string cc = txtcc.Text;
mail.Subject = txtsubject.Text;
mail.Body = txtbody.Text;
SmtpClient smtp = new SmtpClient("SMTP Server");
smtp.Send(mail);
}
}
}
}
and my design page code is bellow-
multiplemailsending22.aspx:-
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="multiplemailsending22.aspx.cs" Inherits="csvfileupload2.multiplemailsending22" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table align="center" bgcolor="#cccc99">
<tr>
<td>
<table cellpadding=3 cellspacing=4 bgcolor="#ccffcc">
<tr>
<td>
<asp:Label ID="lblto" runat="server" Text="To"></asp:Label>
<asp:TextBox ID="txtemailto" runat="server" Width="250"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblfrom" runat="server" Text="From"></asp:Label>
<asp:TextBox ID="txtemailfrom" runat="server" Width="250"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblBcc" runat="server" Text="Bcc"></asp:Label>
<asp:TextBox ID="txtBcc" runat="server" Width="250"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblcc" runat="server" Text="cc"></asp:Label>
<asp:TextBox ID="txtcc" runat="server" Width="250"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblsubject" runat="server" Text="Subject"></asp:Label>
<asp:TextBox ID="txtsubject" runat="server" Width="250"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblbody" runat="server" Text="Body"></asp:Label>
<asp:TextBox ID="txtbody" runat="server" Width="250" Height="50"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblAttachFile" runat="server" Text="File to send:" Width="100px"></asp:Label>
<input type="file" id="fileAttachement" runat="server" name="fileAttachement" width="200px" />
</td>
</tr>
<tr>
<td align="center">
<asp:Button ID="btn1" runat="server" Text="Send" OnClick="btn1_Click"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
please help me
Reply
Answers (
3
)
to make dynamic and image slider we can add,delete images
Data table bind as paging, sorting,searching