登录框设计怎么做,测试用例及步骤分享?

【登录框设计怎么做,测试用例及步骤分享?】我在csdn里搜索了很久,也没有找到符合我要求的login文档,我这次把自己的心得和自己做的成果拿出来和大家分享一下,希望对后来的人能有一些帮助 。我初次做,可能代码写的不是很规范,思路也不是很清晰,但是它能达到我要的效果就行了’ 希望哪位兄弟帮忙完善一下我的代码 。  
我在数据库里有一个 users 的表,如下:  
ID UserName UserPasswd  
1 admin admin  
2 user user  
3 guest guest  
我准备这样做,先判断输入的用户名是否和表里的UserName相同,如果相同,再比较相同UserName下的UserPasswd,如果这些都正确了,就可以进入系统了 。  
全部代码如下(我把我写的部分用黑体):  
Form1的代码:  
using System;  
using System.Drawing;  
using System.Collections;  
using System.ComponentModel;  
using System.Windows.Forms;  
using System.Data;  
using System.Data.SqlClient;  
namespace login  
{  
///  
/// Form1 的摘要说明 。  
/// public class Form1 : System.Windows.Forms.Form  
{  
private  
System.Windows.Forms.Label label1;  
private  
System.Windows.Forms.Label label2;  
private  
System.Windows.Forms.TextBox txtUser;  
private  
System.Windows.Forms.TextBox txtPasswd;  
private  
System.Windows.Forms.Button btnOK;  
private  
System.Windows.Forms.Button btnCancel;  
///  
/// 必需的设计器变量 。  
/// private  
System.ComponentModel.Container components = null;  
public Form1()  
{  
//  
// Windows 窗体设计器支持所必需的  
//  
InitializeComponent();  
//  
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码  
//  
}  
///  
/// 清理所有正在使用的资源 。  
/// protected override void Dispose( bool disposing )  
{  
if( disposing )  
{  
if (components != null)  
{  
components.Dispose();  
}  
}  
base.Dispose( disposing );  
}  
#region Windows 窗体设计器生成的代码  
///  
/// 设计器支持所需的方法 – 不要使用代码编辑器修改  
/// 此方法的内容 。  
/// private void InitializeComponent()  
{  
this.label1 = new  
System.Windows.Forms.Label();  
this.label2 = new  
System.Windows.Forms.Label();  
this.txtUser = new  
System.Windows.Forms.TextBox();  
this.txtPasswd = new  
System.Windows.Forms.TextBox();  
this.btnOK = new  
System.Windows.Forms.Button();  
this.btnCancel = new  
System.Windows.Forms.Button();  
this.SuspendLayout();  
//  
// label1  
//  
this.label1.Font = new System.Drawing.Font(“宋体”, 10.5F,  
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));  
this.label1.Location = new System.Drawing.Point(40, 24);  
this.label1.Name = “label1”;  
this.label1.Size = new System.Drawing.Size(64, 23);  
this.label1.TabIndex = 0;  
this.label1.Text = “用户名:”;  
//  
// label2  
//  
this.label2.Font = new System.Drawing.Font(“宋体”, 10.5F,  
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));  
this.label2.Location = new System.Drawing.Point(40, 72);  
this.label2.Name = “label2”;  
this.label2.Size = new System.Drawing.Size(56, 23);  
this.label2.TabIndex = 1;  
this.label2.Text = “密码:”;  
//  
// txtUser  
//  
this.txtUser.Location = new System.Drawing.Point(152, 24);  
this.txtUser.Name = “txtUser”;  
this.txtUser.TabIndex = 2;  
this.txtUser.Text = “”;  
//  
// txtPasswd  
//  
this.txtPasswd.Location = new System.Drawing.Point(152, 72);


特别声明:本站内容均来自网友提供或互联网,仅供参考,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。