如果你可以請幫助我...我嘗試創建o忘記密碼method.access我的數據庫併發送電子郵件。如果你請幫助我,因爲我沒有很多經驗。事先感謝你。登錄是唯一的。 C#sql asp.net發送電子郵件c#
protected void LinkButton1_Click(object sender, EventArgs e)
{
var sqlCon = new SqlConnection(System.Configuration.ConfigurationManager.
ConnectionStrings["ConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = sqlCon;
cmd.CommandText = "select Password from Person where Login= @Login ";
cmd.Connection.Open();
string Password = cmd.ExecuteScalar().ToString();
cmd.Connection.Close();
cmd.Dispose();
SqlCommand cmd1 = new SqlCommand();
cmd1.Connection = sqlCon;
cmd1.CommandText = "select e_mail from Person where Login= @Login ";
cmd1.Connection.Open();
string e_mail = cmd.ExecuteScalar().ToString();
cmd.Connection.Close();
cmd.Dispose();
if (Login.Text.Equals("@Login"))
{
Class1 S = new Class1();
S.sendMail(e_mail, "Your Password request", Password);
Response.Write("<script>");
}
}
再次輸出一個錯誤,{必須聲明標量變量「@Login」} – emilios
現在試試這個,我添加了一個參數.. –