Quote:http://122.155.1.199:8880
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 Test { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void label1_Click(object sender, EventArgs e) { } private void Form1_Load(object sender, EventArgs e) { } private void btnlogin_Click(object sender, EventArgs e) { SqlConnection objcon = new SqlConnection(); SqlCommand objcom = new SqlCommand(); SqlDataReader objReader; string FullName = String.Empty; string strconstring = null; strconstring = "Data Source=http://122.155.1.199:8880; Database=dblibrary; Initial Catalog=Project;Integrated Security=False;User ID=saa;Password=xxxx"; objcon.ConnectionString = strconstring; objcon.Open(); objcom.CommandType = CommandType.Text; objcom.CommandText = "SELECT * FROM tbluser where UserName = @UserName AND Password = @Password "; objcom.Connection = objcon; objcom.Parameters.Add("@UserName", SqlDbType.VarChar).Value = txtuser.Text; objcom.Parameters.Add("@Password", SqlDbType.VarChar).Value = txtpassword.Text; objReader = objcom.ExecuteReader(); if (objReader.HasRows) { objReader.Read(); Name = objReader.GetString(objReader.GetOrdinal("FullName")); Form2 objForm2 = new Form2(); objForm2.Name = Name.ToString(); objForm2.Show(); Form1 objForm1 = new Form1(); objForm1.Close(); this.Hide(); } else MessageBox.Show("ชื่อผู้ใช้งาน หรือ รหัสผ่าน อาจไม่ถูกต้อง"); objcon.Close(); } private void btncancel_Click(object sender, EventArgs e) { Close(); } } }
strconstring = "Data Source=122.155.1.199; Database=dblibrary; Initial Catalog=Project;Integrated Security=False;User ID=saa;Password=xxxx"; objcon.ConnectionString = strconstring; objcon.Open(); objcom.CommandType = CommandType.Text; objcom.CommandText = "SELECT * FROM tbluser where UserName = @UserName AND Password = @Password "; objcom.Connection = objcon; objcom.Parameters.Add("@UserName", SqlDbType.VarChar).Value = txtuser.Text; objcom.Parameters.Add("@Password", SqlDbType.VarChar).Value = txtpassword.Text; objReader = objcom.ExecuteReader(); if (objReader.HasRows) { objReader.Read(); Name = objReader.GetString(objReader.GetOrdinal("FullName")); Form2 objForm2 = new Form2(); objForm2.Name = Name.ToString(); objForm2.Show(); Form1 objForm1 = new Form1(); objForm1.Close(); this.Hide(); }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง