コード例 #1
0
        public void insert(userinfo info)
        {
            SqlConnection con = new SqlConnection(contr);

            con.Open();
            SqlCommand command = new SqlCommand(string.Format("insert into userinfo values ('{0}','{1}','{2}','{3}')", info.fname, info.lname, info.email, info.password), con);

            command.ExecuteNonQuery();
        }
コード例 #2
0
        public userinfo select(string email, string password)
        {
            userinfo      info = new userinfo();
            SqlConnection sc   = new SqlConnection(contr);

            sc.Open();
            SqlCommand    command = new SqlCommand(string.Format("Select Firstname , Email , Password from userinfo where Email='{0}' AND Password='******'", email, password), sc);
            SqlDataReader sr      = command.ExecuteReader();

            sr.Read();
            info.email    = sr["Email"].ToString();
            info.password = sr["Password"].ToString();
            info.fname    = sr["Firstname"].ToString();
            return(info);
        }
コード例 #3
0
        private void materialFlatButton1_Click(object sender, EventArgs e)
        {
            chat_panel chat = new chat_panel();
            admin      ad   = new admin();

            try
            {
                userinfo info = ad.select(textBox1.Text, textBox2.Text);
                this.Hide();
                chat.Show();
                chat.Text = ("Hello " + info.fname);
            }
            catch (Exception)
            {
                MessageBox.Show("Wrong crendentials");
            }
        }
コード例 #4
0
        private void materialFlatButton1_Click(object sender, EventArgs e)
        {
            userinfo info = new userinfo();

            info.fname    = textBox1.Text;
            info.lname    = textBox2.Text;
            info.email    = textBox3.Text;
            info.password = textBox4.Text;
            admin ad = new admin();

            ad.insert(info);
            MessageBox.Show("Sign up complete");
            Form1 f1 = new Form1();

            f1.Show();
            this.Hide();
        }