求带数据库的在线通讯录的ASP程序代码
我想要一个在线通讯录,单击添加您的记录就可以添加新的人员,单击修改或删除就可以更新记录 从数据库里读取 如下所示我们的通讯录
添加您的新记录
姓名 电话 手机 email 管理
李冰 12345 13475662146 libing@163.com 修改 删除 --------------------编程问答--------------------
http://www.51aspx.com/
找找,你要的这种比较多。
或者google --------------------编程问答-------------------- 才做的一个在线增加商品的 找葫芦画瓢吧
增加商品页面
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class AddPro : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection myconn = new SqlConnection("server=.;database=Adddata;integrated security=true;");
myconn.Open();
string strsql="select * from Cat";
//执行数据操作命令
SqlDataAdapter da = new SqlDataAdapter(strsql,myconn);
DataSet ds = new DataSet();
da.Fill(ds,"CatName");
ddl_cat.DataSource = ds.Tables["CatName"].DefaultView;
ddl_cat.DataTextField = "CatName";
ddl_cat.DataValueField = "CatID";
ddl_cat.DataBind();
myconn.Close();
if (!IsPostBack)
{
ddl_cat.SelectedIndex = 0;
}
}
protected void btn_add_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
SqlConnection myconn = new SqlConnection("server=.;database=Adddata;integrated security=true;");
myconn.Open();
string catname = ddl_cat.SelectedItem.ToString();
int id = Convert.ToInt32(ddl_cat.SelectedValue.ToString());
string name=tbx_proname.Text;
string dec=tbx_dec.Text;
string unit=tbx_unit.Text;
string mf=tbx_mf.Text;
string charge=tbx_charge.Text;
int num = Convert.ToInt32(tbx_amount.Text.ToString());
DateTime date =DateTime.Now;
string strsql = "insert into products(CatID,ProName,Adddate,Unit,Stock,Total,Description,Promf,Charge)";
strsql=strsql + "values (" + id +"," + "'" + name + "','";
strsql=strsql + date +"','" + unit + "'," + num + "," + num + ",'" + dec + "','";
strsql = strsql + mf + "','" + charge + "')";
//创建数据库命令
SqlCommand mycmd = new SqlCommand(strsql, myconn);
//测试用语句
//Response.Write(strsql);
//Response.End();
mycmd.ExecuteNonQuery();
Response.Redirect("ProList.aspx");
}
}
protected void btn_back_Click(object sender, EventArgs e)
{
Response.Redirect("ProList.aspx");
}
protected void ddl_cat_SelectedIndexChanged(object sender, EventArgs e)
{
ddl_cat.DataBind();
}
}
补充:.NET技术 , ASP.NET