-
大小: 6.45MB文件類型: .7z金幣: 1下載: 0 次發(fā)布日期: 2023-11-13
- 語言: 其他
- 標簽: 畢業(yè)設(shè)計??
資源簡介
企業(yè)人事管理軟件及源代碼,非常適合作為畢業(yè)設(shè)計,里面有文檔以及詳細的注釋,自己可以進行改進。
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Data.SqlClient;
namespace?PWMS
{
????public?partial?class?F_Login?:?Form
????{
????????DataClass.MyMeans?MyClass?=?new?PWMS.DataClass.MyMeans();
????????
????????public?F_Login()
????????{
????????????InitializeComponent();
????????}
????????private?void?butClose_Click(object?sender?EventArgs?e)
????????{
????????????if?((int)(this.Tag)?==?1)
????????????{
????????????????DataClass.MyMeans.Login_n?=?3;
????????????????Application.Exit();
????????????}
????????????else
????????????????if?((int)(this.Tag)?==?2)
????????????????????this.Close();
????????}
????????private?void?butLogin_Click(object?sender?EventArgs?e)
????????{
????????????if?(textName.Text?!=?““?&?textPass.Text?!=?““)
????????????{
????????????????SqlDataReader?temDR?=?MyClass.getcom(“select?*?from?tb_Login?where?Name=‘“?+?textName.Text.Trim()?+?“‘?and?Pass=‘“?+?textPass.Text.Trim()?+?“‘“);
????????????????bool?ifcom?=?temDR.Read();
????????????????if?(ifcom)
????????????????{
????????????????????DataClass.MyMeans.Login_Name?=?textName.Text.Trim();
????????????????????DataClass.MyMeans.Login_ID?=?temDR.GetString(0);
????????????????????DataClass.MyMeans.My_con.Close();
????????????????????DataClass.MyMeans.My_con.Dispose();
????????????????????DataClass.MyMeans.Login_n?=?(int)(this.Tag);
????????????????????this.Close();
????????????????}
????????????????else
????????????????{
????????????????????MessageBox.Show(“用戶名或密碼錯誤!“?“提示“?MessageBoxButtons.OK?MessageBoxIcon.Information);
????????????????????textName.Text?=?““;
????????????????????textPass.Text?=?““;
????????????????}
????????????????MyClass.con_close();
????????????}
????????????else
????????????????MessageBox.Show(“請將登錄信息添寫完整!“?“提示“?MessageBoxButtons.OK?MessageBoxIcon.Information);
????????}
????????private?void?F_Login_Load(object?sender?EventArgs?e)
????????{
????????????try
????????????{
????????????????MyClass.con_open();??//連接數(shù)據(jù)庫
????????????????MyClass.con_close();
????????????????textName.Text?=?““;
????????????????textPass.Text?=?““;
????????????}
????????????catch
????????????{
????????????????MessageBox.Show(“數(shù)據(jù)庫連接失敗。“?“提示“?MessageBoxButtons.OK?MessageBoxIcon.Information);
????????????????Application.Exit();
????????????}
????????}
????????private?void?textName_KeyPress(object?sender?KeyPressEventArgs?e)
????????{
????????????if?(e.KeyChar?==?‘\r‘)
????????????????textPass.Focus();
????????}
????????private?void?textPass_KeyPress(object?sender?KeyPressEventArgs?e)
????????{
????????????if?(e.KeyChar?==?‘\r‘)
????????????????butLogin.Focus();
????????}
????????private?void?F_Login_Activated(object?sender?EventArgs?e)
????????{
????????????textName.Focus();
????????}
????}
}
評論
共有 條評論