//FormMain 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; namespace Project_1 { public partial class FormMain : Form { public FormMain() { InitializeComponent(); FormLogin f = new FormLogin(this); f.Show(); } private void FormMain_Load(object sender, EventArgs e) { toolStrip1.Enabled = false; } } } //FormLogin 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; using System.IO; namespace Project_1 { public partial class FormLogin : Form { public FormLogin(FormMain containerForm) { InitializeComponent(); MdiParent = containerForm; } SqlConnection Conn = new SqlConnection(); private void FormLogin_Load(object sender, EventArgs e) { DBConnString Connstring = new DBConnString(); string strConn = Connstring.strConn; if (Conn.State == ConnectionState.Open) { Conn.Close(); } Conn.ConnectionString = strConn; Conn.Open(); } private void btnOk_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); sb.Append("SELECT * FROM Employee"); sb.Append(" WHERE (EmpUsername='" + txtUsername.Text.Trim() + "')"); sb.Append(" AND (EmpPassword='" + txtPassword.Text.Trim() + "')"); string sqlLogin; sqlLogin = sb.ToString(); SqlCommand com = new SqlCommand(); SqlDataReader dr; com.CommandType = CommandType.Text; com.CommandText = sqlLogin; com.Connection = Conn; dr = com.ExecuteReader(); if (dr.HasRows) { this.Hide(); } else { MessageBox.Show("Username หรือ Password ที่คูณป้อนไม่ถูกต้อง !!!", "ผลการทำงาน", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtUsername.Text = ""; txtUsername.Focus(); txtPassword.Text = ""; } dr.Close(); dr.Dispose(); } private void btnCancel_Click(object sender, EventArgs e) { Application.Exit(); } } }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง