asp.net 更新数据 学习资料_数据库学习资料
asp.net 更新数据 学习资料由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“数据库学习资料”。
更新数据
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings[“newsConnectionString”].ConnectionString);SqlCommand cmd = new SqlCommand();
cmd.CommandText=“update login set 用户名='”+this.TextBox2.Text+“',密码
='”+this.TextBox3.Text+“',年龄='”+this.TextBox4.Text+“',性别='”+this.TextBox5.Text+“',备注='”+this.TextBox6.Text+“'where 编号=”+this.TextBox1.Text+“”;
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
Response.Redirect(“Default.aspx”);
con.Close();
}
删除数据protected void Button2_Click(object sender, EventArgs e){SqlConnection conn = newSqlConnection(ConfigurationManager.ConnectionStrings["newsConnectionSt......
前台代码<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login" %> "http://www.daodoc.com/TR/xhtml1/DTD/xhtml1-transiti......
前台代码<%@ Page Language="C#" AutoEventWireup="true"CodeFile="Default.aspx.cs" Inherits="_Default" %> "http://www.daodoc.com/TR/xhtml1/DTD/xhtml1-tran......
检查用户名是否存在功能模块protected void Button1_Click(object sender, EventArgs e){usernamevalidate();}private int usernamevalidate(){SqlConnection conn = newSq......
后台代码protected void Button1_Click(object sender, EventArgs e){SqlConnection conn = newSqlConnection(ConfigurationManager.ConnectionStrings["connection"].Co......
