欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

VS2012實(shí)現(xiàn)簡(jiǎn)單登錄界面

 更新時(shí)間:2018年06月05日 11:54:59   作者:Wu_zx520  
這篇文章主要為大家詳細(xì)介紹了VS2012實(shí)現(xiàn)簡(jiǎn)單登錄界面,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了VS2012實(shí)現(xiàn)登錄界面的具體代碼,供大家參考,具體內(nèi)容如下

這個(gè)是第一個(gè)界面的代碼:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace 登錄x
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }

    private void userInfoBindingNavigatorSaveItem_Click(object sender, EventArgs e)
    {
      this.Validate();
      this.userInfoBindingSource.EndEdit();
      this.tableAdapterManager.UpdateAll(this.studentRecordDataSet);

    }

    private void Form1_Load(object sender, EventArgs e)
    {
      // TODO: 這行代碼將數(shù)據(jù)加載到表“studentRecordDataSet1.UserInfo”中。您可以根據(jù)需要移動(dòng)或刪除它。
      this.userInfoTableAdapter1.Fill(this.studentRecordDataSet1.UserInfo);
      // TODO: 這行代碼將數(shù)據(jù)加載到表“studentRecordDataSet.UserInfo”中。您可以根據(jù)需要移動(dòng)或刪除它。
      this.userInfoTableAdapter.Fill(this.studentRecordDataSet.UserInfo);

    }

    private void passwordLabel_Click(object sender, EventArgs e)
    {

    }

    private void button1_Click(object sender, EventArgs e)
    {
      string connString = @"Data Source=.;Initial Catalog=studentrecord;Integrated Security=True";
      SqlConnection conn = new SqlConnection(connString);
      string sql = "select count(*) from UserInfo where username='" + userNameComboBox.Text + "'and password='" + passwordTextBox.Text + "'";
      conn.Open();
      SqlCommand comm = new SqlCommand(sql, conn);
      int num = (int)comm.ExecuteScalar();
      if (num > 0)
      {
        Form2 frm2 = new Form2();
        frm2.Show();

      }
      else
      {
        MessageBox.Show("對(duì)不起,用戶名和密碼并不匹配!", "登陸失敗");
      }
      conn.Close();
    }

    private void userNameComboBox_SelectedIndexChanged(object sender, EventArgs e)
    {

    }

    private void passwordTextBox_TextChanged(object sender, EventArgs e)
    {

    }
  }
}

這個(gè)是第二個(gè)界面的代碼:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 登錄x
{
  public partial class Form2 : Form
  {
    public Form2()
    {
      InitializeComponent();
    }

    private void label1_Click(object sender, EventArgs e)
    {

    }
  }
}

運(yùn)行結(jié)果如圖:

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論