Partial Class H_login Inherits System.Web.UI.Page Public Class Sconn Public Shared Function Stringkoneksi() As String Return ConfigurationManager.ConnectionStrings("LoginSystem").ConnectionString End Function End Class Protected Sub cmdlogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdlogin.Click Using db2Conn As New DB2Connection(Sconn.Stringkoneksi) db2Conn.Open() Dim strQuery As String = "SELECT * FROM dblogin WHERE USERID ='" & Me.tbUserName.Text & "' and PASS = '" & Me.tbPassword.Text & "';" Dim db2Cmd As New DB2Command(strQuery, db2Conn) Dim db2Rdr As DB2DataReader = db2Cmd.ExecuteReader() Dim strusername As String Dim strpassword As String strusername = "" strpassword = "" While db2Rdr.Read() strusername = db2Rdr.GetString(0) strpassword = db2Rdr.GetString(5) End While If strusername = "" Then Me.label1.Text = "UserName tidak ada!" Else If strpassword <> Me.tbPassword.Text Then Me.label1.Text = "Password anda salah!" Else Me.label1.Text = "Login sukses!" End If End If db2Conn.Close() End Using End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)