12.20
来源:互联网 发布:双端面磨床 知乎 编辑:程序博客网 时间:2024/06/05 10:13
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.Net;
using System.Configuration;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string str = ConfigurationManager.ConnectionStrings["treecnn"].ConnectionString;
using (SqlConnection cnn = new SqlConnection(str))
{
SqlCommand cmm = cnn.CreateCommand();
cmm.CommandText = "insert into z1 (zh,mm,jh) values('" + this.TextBox1.Text + "','" + this.TextBox2.Text + "','" + Session["yanzheng"].ToString() + "')";
cnn.Open();
cmm.ExecuteNonQuery();
cnn.Close();
}
Sendmail();
}
private void Sendmail()
{
MailMessage msg = new MailMessage();
msg.Body = Session["yanzheng"].ToString();
msg.From = new MailAddress("1241437018@qq.com");
msg.Subject = "激活号";
msg.To.Add(this.TextBox4.Text);
msg.IsBodyHtml = true;
SmtpClient sc = new SmtpClient();
sc.Host = "smtp.qq.com";
sc.Port = 25;
NetworkCredential nc = new NetworkCredential();
nc.UserName = "1241437018";
nc.Password = "qaz753";
sc.Credentials = nc;
sc.Send(msg);
}
protected void Button2_Click(object sender, EventArgs e)
{
string str = ConfigurationManager.ConnectionStrings["treecnn"].ConnectionString;
using (SqlConnection sqlcnn = new SqlConnection(str))
{
using (SqlCommand sqlcmm = sqlcnn.CreateCommand())
{
sqlcmm.CommandText = "select * from z1 where zh='" + this.TextBox1.Text + "' and mm='"+this.TextBox2.Text+"'";
sqlcnn.Open();
SqlDataReader reader = sqlcmm.ExecuteReader();
while (reader.Read())
{
reader["jh"].ToString();
if (reader["jh"].ToString() == this.TextBox5.Text)
{
using (SqlConnection sql = new SqlConnection(str))
{
using (SqlCommand sqm = sql.CreateCommand())
{
sql.Open();
sqm.CommandText = "update z1 set jh=@jh where zh='" + this.TextBox1.Text + " and mm=" + this.TextBox2.Text + "'";
sqm.Parameters.AddWithValue("@jh","1");
sqm.ExecuteNonQuery();
}
}
this.Label1.Text = "激活成功";
}
else
{
this.Label1.Text = "激活码错误";
}
}
}
}
}
protected void Button3_Click(object sender, EventArgs e)
{
string str = ConfigurationManager.ConnectionStrings["treecnn"].ConnectionString;
using (SqlConnection sqlcnn = new SqlConnection(str))
{
using (SqlCommand sqlcmm = sqlcnn.CreateCommand())
{
sqlcmm.CommandText = "select * from z1 where zh='" + this.TextBox6.Text + "' and mm='" + this.TextBox7.Text + "'";
sqlcnn.Open();
SqlDataReader reader = sqlcmm.ExecuteReader();
while (reader.Read())
{
reader["jh"].ToString();
if (reader["jh"].ToString() == "1")
{
this.Label2.Text = "登入成功";
}
else
{
this.Label2.Text = "账号未激活";
}
}
}
}
}
}
- 12.20
- 12.20
- 12.20
- 12.20
- 12.20
- 12.20总结
- 12.20笔记
- Reflection2017.12.20
- 12.20学习计划
- 12.20调试笔记
- 每日一题12.20
- GDOI2015模拟12.20小结
- 小程序12.20
- 每周一报 12.20
- C++ primer学习12.20
- 12.20 session+model+redirect
- 12.20培训日记
- 12.20 路径跳转问题
- try catch finally与return的执行顺序
- Arrays Question
- pkg-config的使用
- C语言程序>>SPI
- android 文件
- 12.20
- Android应用程序消息处理机制(Looper、Handler)分析
- python装饰器学习总结
- C语言程序>>LCD1602
- Lenix固定长度内存分配源代码分析(草稿)
- 链表 链栈 链队列的建立
- [Java Path Finder][JPF学习笔记][7]JPF输出详细程度设置
- C语言程序>>IIC
- HDU菜鸟杯大赛第五题 KFC -Z+W