Dim msg as string
Try
Session.RemoveAll()
objCommand = New SqlCommand
objCommand.Connection = MyConnect.open
objCommand.CommandType = CommandType.Text
objCommand.CommandText = "select * from ViewUserID where UserName ='" & TextBox1.Text & "' " & _
" and password ='" & TextBox2.Text & "'"
objDataReader = objCommand.ExecuteReader
If objDataReader.Read Then
Session("Username") = TextBox1.Text
Session("Password") = TextBox2.Text
Session("Perusahaan") = objDataReader.Item("Namaperusahaan").ToString
Session("Access") = objDataReader.Item("Access").ToString
Response.Redirect("Default.aspx")
Else
msg = "alert('User Name / Password Tidak Valid');"
Page.ClientScript.RegisterStartupScript(Me.GetType(), "Pesan", msg, True)
objCommand.Dispose()
MyConnect.close()
End If
Catch ie As Exception
End Try
objCommand.Dispose()
MyConnect.close()
Tidak ada komentar:
Posting Komentar