内容添加asp.net
发布时间:2016-12-29 来源:查字典编辑
摘要:privatevoidButton1_Click(objectsender,System.EventArgse){if(this.IsVal...
privatevoidButton1_Click(objectsender,System.EventArgse)
{
if(this.IsValid){
OleDbConnectionconn=dbconn.createconn();
conn.Open();
OleDbCommandcmd=newOleDbCommand();
cmd.CommandText="insertintoa(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();
}
}
}