Home>

This is the code for the first interface:

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 login 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:This line of code loads the data into the table "studentrecorddataset1.userinfo". You can move or delete it as needed.
      this.userinfotableadapter1.fill (this.studentrecorddataset1.userinfo);
      //todo:This line of code loads the data into the table "studentrecorddataset.userinfo". You can move or delete it as needed.
      this.userinfotableadapter.fill (this.studentrecorddataset.userinfo);
    }
    private void passwordlabel_click (object sender, eventargs e)
    {
    }
    private void button1_click (object sender, eventargs e)
    {
      string connstring [email protected]"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 ("Sorry, username and password do not match!", "Login failed");
      }
      conn.close ();
    }
    private void usernamecombobox_selectedindexchanged (object sender, eventargs e)
    {
    }
    private void passwordtextbox_textchanged (object sender, eventargs e)
    {
    }
  }
}

This is the code for the second interface:

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 login x
{
  public partial class form2:form
  {
    public form2 ()
    {
      initializecomponent ();
    }
    private void label1_click (object sender, eventargs e)
    {
    }
  }
}

The results are shown in the figure:

  • Previous Implementation method of converting Long to date format in Js
  • Next Python reading txt, json and hdf5 files