成都创新互联专注于企业营销型网站、网站重做改版、京口网站定制设计、自适应品牌网站建设、成都h5网站建设、电子商务商城网站建设、集团公司官网建设、外贸营销网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为京口等各大城市提供网站开发制作服务。
源代码:
Height="16px" Width="848px">
留言者: <%# Eval("username") %>
EMAIL: <%# Eval("email") %>
留言时间: <%# Eval("posttime")%>
留言内容: <%# Eval("contente")%>
回复内容: <%# Eval("reply")%>
查看留言界面:
protected void Page_Load(object sender, EventArgs e)
{
string conn = "Data Source=.;Initial Catalog=Information;Integrated Security=True";
SqlConnection con = new SqlConnection(conn);
string sqlstr = "select*from Message";
SqlDataAdapter ad = new SqlDataAdapter(sqlstr,con);
DataSet ds = new DataSet();
con.Open();
ad.Fill(ds);
con.Close();
DataList1.DataSource = ds.Tables[0].DefaultView;
DataList1.DataBind();
}
留言界面:
using System.Data.SqlClient;
using System.Data;
protected void Button2_Click(object sender, EventArgs e)//取消留言
{
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
}
protected void Button1_Click(object sender, EventArgs e)//发送留言
{
string conn = "Data Source=.;Initial Catalog=Information;Integrated Security=True";
SqlConnection con = new SqlConnection(conn);
string sqlstr = "insert into Message(username,sex,email,contente,p_w_picpathadd)values('" + TextBox1.Text + "','" + RadioButtonList1.SelectedValue + "','" + TextBox2.Text + "','" + TextBox3.Text + "','3.jpg')";
SqlDataAdapter ad = new SqlDataAdapter(sqlstr, con);
DataSet ds = new DataSet();
ad.Fill(ds);
}