 |
|
อยากได้โค้ดในการสร้าง login อะ ครับ (ช่วยด่วน นะครับ)) |
|
 |
|
|
 |
 |
|
คือว่ามันก็ต้องสร้างฐานข้อมูลด้วยอ่ะค่ะแล้วก็กำหนดค่าลงไปในฐานข้อมูล
ไม่รู้เข้าใจถูกป่าวน่ะค่ะมือใหม่เหมือนกัน 
|
 |
 |
 |
 |
Date :
2012-04-23 04:48:15 |
By :
yeanii |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
@ mr.win ขอคุณ ครับ แต่ไม่เข้าใจยุดี อะครับ ยังไง ก้ช่วย หน่อย นะ ครับ ( มือใหม่ อะครับ)
|
 |
 |
 |
 |
Date :
2012-04-23 13:36:23 |
By :
Tar Sathaaporn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ของผมเข้าใจง่ายๆ เอามาเเจก
Code (VB.NET)
Imports System.Data
Imports System.Data.SqlClient
Public Class Login
Dim Conn As SqlConnection = New SqlConnection
Dim da As SqlDataAdapter
Dim sale As SqlCommand
Dim dssale As DataSet
Dim sqlserch As String
Dim serch_value As String
Dim ds As New DataSet
Dim IsFind As Boolean = False
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Dim sqlusers As String = ""
sqlusers = "select * from users where LOGINNAME = '" & txtname.Text & "'"
sqlusers &= "AND PASSWD = '" & txtpass.Text & "'"
With Conn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = strConnString
.Open()
If IsFind = True Then
ds.Tables("users").Clear()
End If
da = New SqlDataAdapter(sqlusers, Conn)
da.Fill(ds, "users")
ds.Tables("users").Clear()
da = New SqlDataAdapter(sqlusers, Conn)
da.Fill(ds, "users")
If ds.Tables("users").Rows.Count > 0 Then
txtname.DataBindings.Clear()
txtpass.DataBindings.Add("text", ds, "users.PASSWD")
If txtpass.Text = txtpass.Text Then
Me.Hide()
Main.Show()
Else
MsgBox("รหัสผ่านไม่ถูกต้อง", , "ข้อผิดพลาด")
txtname.Text = ""
txtpass.Text = ""
txtname.Focus()
End If
Else
MsgBox("ไม่พบข้อมูลที่ต้องการเข้าระบบ", MsgBoxStyle.OkOnly, "ข้อผิดพลาด")
txtname.Text = ""
txtpass.Text = ""
txtname.Focus()
End If
End With
End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
If MessageBox.Show("ต้องการออกจากโปรแกรมใช่หรือไม่?", "คำยืนยัน", _
MessageBoxButtons.YesNo, MessageBoxIcon.Question) = vbYes Then
End
End If
End Sub
End Class
|
 |
 |
 |
 |
Date :
2012-04-23 13:50:02 |
By :
pisansri |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แล้วผมจะสร้าง ตารางที่ชื่อว่า Member ยัง ไง แล้ว database.mdb หาได้จาใหน คับ ผมใช้ Vb 2010 อะ คับ ช่วย ที คับ
|
 |
 |
 |
 |
Date :
2012-04-23 14:07:00 |
By :
Tar Sathaaporn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
database.mdb
หาได้จากการสร้าง ฐานข้อมูลด้วย Access ครับ ผมแนะนำให้ไปหาหนังสืออ่านก่อนดีกว่าครับ เพราะไม่นั้นไปไม่ถูกแน่นอน
|
 |
 |
 |
 |
Date :
2012-04-23 14:08:26 |
By :
manman12307 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
database.mdb
มันหาไม่เจอใน คอมเลย อะ คับ ในโปรแกรมก้ไม่มี อะ ช่วยด่วนๆๆๆ
|
 |
 |
 |
 |
Date :
2012-04-23 14:40:29 |
By :
Tar Sathaaporn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ในตัวอย่างผมมีให้พร้อมน่ะครับ คุณไม่ได้ดูเหรอครับ 
|
 |
 |
 |
 |
Date :
2012-04-23 14:53:27 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำตามทุกขั้นตอนแล้วคับ แต่ ว่ามัน ขึ้นแบบนี้ อะคับ

|
 |
 |
 |
 |
Date :
2012-04-23 21:37:03 |
By :
Tar Sathaaporn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมว่าซื้อหนังสือ VB มาอ่านก็น่าจาเขียนได้แล้วครับ แค่ดึงข้อมูบจาก Database เป็น ก็เขียนโปรแกรม Login ได้แล้วครับ
หลักการณ์
- กรอกข้อมูล Id Pws แล้วนำไป Select ใน Database
- นับแถวที่ Select ได้ครับว่ามีจำนวนแถว 0 แถว หรือ 1 แถว
ถ้าเป็น 0 แถว แปลว่า ID หรือ Pws ผิด
ถ้าเป็น 1 แถว แปลว่า Login ผ่าน
- ถ้าผ่านก็สั่งให้เปิดฟอร์ม ที่ต้องการ
ลองเขียนเองเลยครับไม่ยาก
ปล วิธีติดต่อดาต้าเบสทุกตัว และดึงลบแก้ไขฐานข้อมูลมีอยู่ในหนังสือเกือบทุกเล่มครับ
|
 |
 |
 |
 |
Date :
2012-04-24 00:49:34 |
By :
Guest |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|