zoukankan      html  css  js  c++  java
  • asp.net中自定义验证控件的简单用法

            private void CustomValidator1_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
            
    {
                
    string username=args.Value;
                OleDbConnection conn 
    = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source="+HttpContext.Current.Server.MapPath("db.mdb"));
                conn.Open();
                OleDbCommand cmd
    =new OleDbCommand("select Count(*) from GuestBook where Username='"+this.TextBox8.Text+"'",conn);
                
    int count=Convert.ToInt32(cmd.ExecuteScalar());
                
    if(count>0)
                
    {
                    args.IsValid
    =false;
                }

                
    else
                
    {
                    args.IsValid
    =true;
                }


                conn.Close();
            }
    这里使用的是ACCESS数据库
  • 相关阅读:
    url编码
    客户端安全-xss-1类型介绍
    阿里云扩容教程
    jquery获取和设置表单数据
    uMlet建模工具
    phpstorm的调试工具xdebug
    服务器如何处理http请求
    http基础实战
    协程
    Goroutine(协程)为何能处理大并发?
  • 原文地址:https://www.cnblogs.com/icejd/p/364399.html
Copyright © 2011-2022 走看看