当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 内容添加asp.net

ASP.NET
深入理解__doPostBack 客户端调用服务端事件
asp.net(c#)利用构造器链的代码
asp.net Repeater绑定时使用函数
asp.net下linkbutton的前后台使用方法
ASP.NET编程中经常用到的27个函数集
asp.net高效替换大容量字符实现代码
asp.net(c#) ubb处理类
ASP.NET中的跳转 200, 301, 302转向实现代码
C#中的委托和事件学习(续)
asp.net网站安全从小做起与防范小结
asp.net 网页编码自动识别代码
asp.net HttpWebRequest自动识别网页编码
asp.net中调用winrar实现压缩解压缩的代码
dz asp.net论坛中函数--根据Url获得源文件内容
.NET 扩展实现代码
用Jquery访问WebService并返回Json的代码
asp.net(c#)判断远程图片是否存在
asp.net保存远程图片的代码
Asp.Net类库中发送电子邮件的代码
ASP.NET表单验证方法详解

ASP.NET 中的 内容添加asp.net


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 87 ::
收藏到网摘: n/a

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();
}
}
}