页面导航: 首页网络编程ASP.NET自学过程 → 正文内容

内容添加asp.net

发布:dxy 字体:[增加 减小] 类型:转载
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();
                }
            }
        }
浏览次数:载入中... 打印本文关闭本文返回首页
·在百度中搜索关于“内容添加asp.net”相关内容
·在谷歌中搜索关于“内容添加asp.net”相关内容

文章评论

共有 位脚本之家网友发表了评论我来说两句

同 类 文 章
最 近 更 新
热 点 排 行