内容添加asp.net
人气:0想了解内容添加asp.net的相关内容吗,在本文为您仔细讲解的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:内容添加asp.net,下面大家一起来学习吧。
private void Button1_Click(object sender, System.EventArgs e) {
if(this.IsValid){
OleDbConnection conn=dbconn.createconn();
conn.Open();
OleDbCommand cmd=new OleDbCommand();
cmd.CommandText="insert into a(title,content)values('"+this.title.Text.Trim().Replace("'","")+"','"+this.content.Text.Trim().Replace("'","")+"')";
cmd.Connection=conn;
try
{
cmd.ExecuteNonQuery();
this.title.Text="";
this.content.Text="";
this.add_info.Text="提交成功";
}
catch
{
this.add_info.Text="出现错误";
}
finally{
conn.Close();
}
}
}
加载全部内容