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

ASP.NET
Asp.Net 通用数据操作类 (附通用数据基类)
asp.net汉字转拼音和获取汉字首字母的代码
asp.net 多字段模糊查询代码
OpenCms 带分页的新闻列表
URLRewriter最简单入门介绍 URLRewriter相关资源
asp.net Repeater取得CheckBox选中的某行某个值
asp.net清空Cookie的两种方法
asp.net一些很酷很实用的.Net技巧
asp.net生成高质量缩略图通用函数(c#代码),支持多种生成方式
asp.net TripleDES加密、解密算法
Asp.net中防止用户多次登录的方法
asp.net Repeater取得CheckBox选中的某行某个值的c#写法
asp.net DataGridView导出到Excel的三个方法[亲测]
C#,winform,ShowDialog,子窗体向父窗体传值
asp.net学习中发现的比较完整的流程
ASP.net 页面被关闭后,服务器端是否仍然执行中?
asp.net Context.Handler 页面间传值方法
asp.net xml序列化与反序列化
asp.net实例代码protected override void Render(HtmlTextWriter writer)
asp.net(c#)捕捉搜索引擎蜘蛛和机器人

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 81 ::
收藏到网摘: 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();
}
}
}