|
|
- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -
|
|
|
กระทู้ #2339 [Vb] (จาก IP: 118.172.135.169)
อยากได้ตัวอย่าง Form-Code ของ Login กับ ค้นหา เชื่อมต่อ Access2003
อยากได้ตัวอย่าง Form-Code ของ Login กับ ค้นหา เชื่อมต่อ Access2003
รบกวนผู้ใจบุญโพสไว้ได้ไหมคับ หรือไม่แนบไฟล์ส่งทางเมล์ por_xpro_2004@hotmail.com
จะเอาไปทำโปรเจคคับ ส่งศุกร์นี้แล้ว
ขอบคุณอย่างสูงมากนะคับ
ถ้าเป็น VB2005 จะดีมากเลยคับ
|
จากคุณ
:
Momentum / por_xpro_2004@hotmail.com [2008-10-14 16:42:56]
|
|
ความคิดเห็น #27786 (จาก IP: 117.47.137.93)
Imports System.Data.OleDb
Public Class LoginForm1 Dim sconn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Nhootong.mdb;" Dim conn As OleDbConnection Dim da As OleDbDataAdapter Dim Cnn As New OleDbConnection(Cnnstring) Dim Cnnstring As String Dim SqlSelect As String Dim OleReader As OleDbDataReader Dim UserIDA As String Dim PassIDA As String ' TODO: Insert code to perform custom authentication using the provided username and password ' (See http://go.microsoft.com/fwlink/?LinkId=35339). ' The custom principal can then be attached to the current thread's principal as follows: ' My.User.CurrentPrincipal = CustomPrincipal ' where CustomPrincipal is the IPrincipal implementation used to perform authentication. ' Subsequently, My.User will return identity information encapsulated in the CustomPrincipal object ' such as the username, display name, etc.
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click With (Cnn) If .State = ConnectionState.Open Then .ConnectionString = sconn .Open() Close() End If End With If UsernameTextBox.Text = "" Then MessageBox.Show("ใส่ข้อมูล", "No UserID", MessageBoxButtons.OK, MessageBoxIcon.Error) Else ReadMyData(Cnnstring) End If End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click Me.Close() End Sub
Public Sub ReadMyData(ByVal myConnString As String) On Error GoTo 0 With (Cnn) If .State = ConnectionState.Open Then Close() .ConnectionString = sconn .Open() End With SqlSelect = "select * from Login Where Username = " & "'" & UsernameTextBox.Text & "'" Dim OleCommand As New OleDbCommand(SqlSelect, Cnn) OleReader = OleCommand.ExecuteReader OleReader.Read() UserIDA = OleReader.Item("username") PassIDA = OleReader.Item("password") Cnn.Close() If UsernameTextBox.Text = UserIDA And PasswordTextBox.Text = PassIDA Then main2.Show() UsernameTextBox.Text = "" PasswordTextBox.Text = "" Me.Hide() Else MessageBox.Show("กรุณาใส่ข้อมูลให้ถูกต้อง", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning) End If
End Sub
Private Sub LogoPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogoPictureBox.Click
End Sub End Class |
จากคุณ
:
วิว / cowold_vs@hotmail.com [2010-02-11 22:35:01]
|
|
|
- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -
|
|
|
|
|