Showing posts with label enter. Show all posts
Showing posts with label enter. Show all posts

Monday, March 19, 2012

email notifications scheduled jobs

In the notifications tab of the job I have e-mail operator selected. Click on the box with the elipses to enter the email addresses. It will let me enter 2 email addresses in the e-mail name field. It looks like the field has a limited length...is there a way to manually enter several addresses?http://www.sqlmag.com/Article/ArticleID/21450/sql_server_21450.html
http://www.informit.com/guides/content.asp?g=sqlserver&seqNum=31

Sunday, March 11, 2012

email error

the site i am working on iswww.papertrailinvites.com

on the left when you enter your email address and hit submit i get this error:

Server Error in '/' Application.

Must declare the scalar variable "@.Email".

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: Must declare the scalar variable "@.Email".

Source Error:

Line 29: Line 30: conn.Open();Line 31: cmd.ExecuteNonQuery();Line 32: Line 33: }

My code is below:

protected void Button1_Click(object sender, EventArgs e) {using (SqlConnection conn =new SqlConnection(ConfigurationManager.ConnectionStrings["cardsConnectionString1"].ConnectionString)) {string email = Newsletter_Email.Text; SqlCommand cmd =new SqlCommand("INSERT INTO Email (EmailAddress) Values (@.Email)", conn); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@.Name", email); conn.Open(); cmd.ExecuteNonQuery(); } }

it looks like you mixed up "name" and "email"

try this:

protected void Button1_Click(object sender, EventArgs e) {using (SqlConnection conn =new SqlConnection(ConfigurationManager.ConnectionStrings["cardsConnectionString1"].ConnectionString)) {string email = Newsletter_Email.Text; SqlCommand cmd =new SqlCommand("INSERT INTO Email (EmailAddress) Values (@.Email)", conn); cmd.CommandType = CommandType.Text;//re-name param to match the cmd statement cmd.Parameters.AddWithValue("@.Email", email); conn.Open(); cmd.ExecuteNonQuery(); } }

|||

gers my code and i still get the error...

protectedvoid Button1_Click(object sender,EventArgs e)

{

using (SqlConnection conn =newSqlConnection(ConfigurationManager.ConnectionStrings["cardsConnectionString1"].ConnectionString)) {String newemail = Newsletter_Email.Text;

SqlCommand cmd =newSqlCommand("INSERT INTO Email (EmailAddress) Values (@.EmailAddress)", conn);

cmd.CommandType =

CommandType.Text;

cmd.Parameters.AddWithValue(

"@.EmailAdress", newemail);

conn.Open();

cmd.ExecuteNonQuery();

}

|||

double check your spelling.

your sql says: @.EmailAddress

your param says: @.EmailAdress