ASP.Net增删查改写的一个通讯录系统

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data.SqlClient;using System.Data;public partial class _Default : Page{protected void Page_Load(object sender, EventArgs e){}protected void LinkButton1_Click(object sender, EventArgs e){string ConString="Data Source=(LocalDB)\\v11.0;AttachDbFilename=d:\\UserFile\\Documents\\Visual Studio 2013\\WebSites\\WebSite5\\App_Data\\contact.mdf;Integrated Security=True";string sql1 = "select * from contact";SqlConnection myconn = new SqlConnection(ConString);SqlCommand mycmd = new SqlCommand(sql1, myconn);SqlDataAdapter sda = new SqlDataAdapter(mycmd);DataSet ds = new DataSet();sda.Fill(ds, "contact");this.GridView1.DataSource = ds.Tables["contact"];this.GridView1.DataBind();myconn.Close();}protected void Button1_Click(object sender, EventArgs e){string ConString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=d:\\UserFile\\Documents\\Visual Studio 2013\\WebSites\\WebSite5\\App_Data\\contact.mdf;Integrated Security=True";string sql1 = "select * from contact where name='"+this.Name.Text.ToString().Trim()+"';";SqlConnection myconn = new SqlConnection(ConString);SqlCommand mycmd = new SqlCommand(sql1, myconn);SqlDataAdapter sda = new SqlDataAdapter(mycmd);DataSet ds = new DataSet();sda.Fill(ds, "contact");this.GridView1.DataSource = ds.Tables["contact"];this.GridView1.DataBind();myconn.Close();}protected void Button2_Click(object sender, EventArgs e){string ConString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=d:\\UserFile\\Documents\\Visual Studio 2013\\WebSites\\WebSite5\\App_Data\\contact.mdf;Integrated Security=True";string sql1 = "select * from contact where address='"+this.Address.Text+"';";SqlConnection myconn = new SqlConnection(ConString);SqlCommand mycmd = new SqlCommand(sql1, myconn);SqlDataAdapter sda = new SqlDataAdapter(mycmd);DataSet ds = new DataSet();sda.Fill(ds, "contact");this.GridView1.DataSource = ds.Tables["contact"];this.GridView1.DataBind();myconn.Close();}protected void Button3_Click(object sender, EventArgs e){string ConString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=d:\\UserFile\\Documents\\Visual Studio 2013\\WebSites\\WebSite5\\App_Data\\contact.mdf;Integrated Security=True";string sql1 = "select * from contact where vocation='"+this.vocation.Text+"';";SqlConnection myconn = new SqlConnection(ConString);SqlCommand mycmd = new SqlCommand(sql1, myconn);SqlDataAdapter sda = new SqlDataAdapter(mycmd);DataSet ds = new DataSet();sda.Fill(ds, "contact");this.GridView1.DataSource = ds.Tables["contact"];this.GridView1.DataBind();myconn.Close();}protected void vocation_TextChanged(object sender, EventArgs e){}}

,家门前的那条小路,到底通向了什么样的远方呢?

ASP.Net增删查改写的一个通讯录系统

相关文章:

你感兴趣的文章:

标签云: