1![]() 方法一:
方法一: 
2![]() private void btnNext_Click(object sender, System.EventArgs e)
private void btnNext_Click(object sender, System.EventArgs e) 
3![]() {
        { 
4![]() if(Page.IsValid)
            if(Page.IsValid) 
5![]() {
            { 
6![]() strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("txl.aspx");
                strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("txl.aspx"); 
7![]() cn=new OleDbConnection(strConn);
                cn=new OleDbConnection(strConn); 
8![]() strSQL="select count(u_id) from userinfo where u_account='"+txtAccount.Text.ToString()+"'";
    strSQL="select count(u_id) from userinfo where u_account='"+txtAccount.Text.ToString()+"'"; 
9![]() 
                 
10![]() cn.Open();
                cn.Open(); 
11![]() cmd=new OleDbCommand(strSQL,cn);
                cmd=new OleDbCommand(strSQL,cn); 
12![]() 
                 
13![]() int flag=(int)cmd.ExecuteScalar();
                int flag=(int)cmd.ExecuteScalar(); 
14![]() 
                 
15![]() if(flag>0)
                if(flag>0) 
16![]() 
 
17![]() {
                { 
18![]() lblStep2.Text="您输入的用户名已经存在,请您选择一个其他的名字!";
                    lblStep2.Text="您输入的用户名已经存在,请您选择一个其他的名字!"; 
19![]() cn.Close();
                    cn.Close(); 
20![]() 
                     
21![]() //txtAccount.Text="";
                    //txtAccount.Text=""; 
22![]() }
                } 
23![]() else
                else 
24![]() {
                { 
25![]() cn.Close();
                    cn.Close(); 
26![]() lblPwd.Text=txtUpwd.Text.ToString();
                    lblPwd.Text=txtUpwd.Text.ToString(); 
27![]() 
                     
28![]() }
                } 
29![]() }
            }             
30![]() }
        } 
31![]() 
 
32![]() 
 
33![]() 
 
34![]() 方法二:
方法二: 
35![]() private void btnNext_Click(object sender, System.EventArgs e)
private void btnNext_Click(object sender, System.EventArgs e) 
36![]() {
        { 
37![]() if(Page.IsValid)
            if(Page.IsValid) 
38![]() {
            { 
39![]() 
 
40![]() strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("txl.aspx");
    strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("txl.aspx"); 
41![]() cn=new OleDbConnection(strConn);
    cn=new OleDbConnection(strConn); 
42![]() strSQL="select u_id from userinfo where u_account='"+txtAccount.Text.ToString()+"'";
    strSQL="select u_id from userinfo where u_account='"+txtAccount.Text.ToString()+"'"; 
43![]() 
    
44![]() dr=cmd.ExecuteReader();
        dr=cmd.ExecuteReader(); 
45![]() if(dr.Read())
        if(dr.Read()) 
46![]() {
{ 
47![]() lblStep2.Text="您输入的用户名已经存在,请您选择一个其他的名字!";
                    lblStep2.Text="您输入的用户名已经存在,请您选择一个其他的名字!"; 
48![]() cn.Close();
                    cn.Close(); 
49![]() 
                     
50![]() //txtAccount.Text="";
                    //txtAccount.Text=""; 
51![]() }
                } 
52![]() else
                else 
53![]() {
                { 
54![]() cn.Close();
                    cn.Close(); 
55![]() lblPwd.Text=txtUpwd.Text.ToString();
                    lblPwd.Text=txtUpwd.Text.ToString(); 
56![]() 
                     
57![]() 
 
58![]() }
                } 
59![]() }
            }             
60![]() }
        } 
61![]() 
 
62![]() 
 
 方法一:
方法一: 2
 private void btnNext_Click(object sender, System.EventArgs e)
private void btnNext_Click(object sender, System.EventArgs e) 3
 {
        { 4
 if(Page.IsValid)
            if(Page.IsValid) 5
 {
            { 6
 strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("txl.aspx");
                strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("txl.aspx"); 7
 cn=new OleDbConnection(strConn);
                cn=new OleDbConnection(strConn); 8
 strSQL="select count(u_id) from userinfo where u_account='"+txtAccount.Text.ToString()+"'";
    strSQL="select count(u_id) from userinfo where u_account='"+txtAccount.Text.ToString()+"'"; 9
 
                 10
 cn.Open();
                cn.Open(); 11
 cmd=new OleDbCommand(strSQL,cn);
                cmd=new OleDbCommand(strSQL,cn); 12
 
                 13
 int flag=(int)cmd.ExecuteScalar();
                int flag=(int)cmd.ExecuteScalar(); 14
 
                 15
 if(flag>0)
                if(flag>0) 16
 
 17
 {
                { 18
 lblStep2.Text="您输入的用户名已经存在,请您选择一个其他的名字!";
                    lblStep2.Text="您输入的用户名已经存在,请您选择一个其他的名字!"; 19
 cn.Close();
                    cn.Close(); 20
 
                     21
 //txtAccount.Text="";
                    //txtAccount.Text=""; 22
 }
                } 23
 else
                else 24
 {
                { 25
 cn.Close();
                    cn.Close(); 26
 lblPwd.Text=txtUpwd.Text.ToString();
                    lblPwd.Text=txtUpwd.Text.ToString(); 27
 
                     28
 }
                } 29
 }
            }             30
 }
        } 31
 
 32
 
 33
 
 34
 方法二:
方法二: 35
 private void btnNext_Click(object sender, System.EventArgs e)
private void btnNext_Click(object sender, System.EventArgs e) 36
 {
        { 37
 if(Page.IsValid)
            if(Page.IsValid) 38
 {
            { 39
 
 40
 strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("txl.aspx");
    strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("txl.aspx"); 41
 cn=new OleDbConnection(strConn);
    cn=new OleDbConnection(strConn); 42
 strSQL="select u_id from userinfo where u_account='"+txtAccount.Text.ToString()+"'";
    strSQL="select u_id from userinfo where u_account='"+txtAccount.Text.ToString()+"'"; 43
 
    44
 dr=cmd.ExecuteReader();
        dr=cmd.ExecuteReader(); 45
 if(dr.Read())
        if(dr.Read()) 46
 {
{ 47
 lblStep2.Text="您输入的用户名已经存在,请您选择一个其他的名字!";
                    lblStep2.Text="您输入的用户名已经存在,请您选择一个其他的名字!"; 48
 cn.Close();
                    cn.Close(); 49
 
                     50
 //txtAccount.Text="";
                    //txtAccount.Text=""; 51
 }
                } 52
 else
                else 53
 {
                { 54
 cn.Close();
                    cn.Close(); 55
 lblPwd.Text=txtUpwd.Text.ToString();
                    lblPwd.Text=txtUpwd.Text.ToString(); 56
 
                     57
 
 58
 }
                } 59
 }
            }             60
 }
        } 61
 
 62
 
  
 
         
        
 
             
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号