Şekil 1
Default.aspx.vb sayfası:
Imports System.Data
Imports System.Data.OleDb
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Dim baglan As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("App_Data/bilgi.mdb"))
Dim cmd As OleDb.OleDbCommand = New OleDb.OleDbCommand("Select * From login where Ad='" & txtAd.Text & "' And Password='" & txtPassword.Text & "'", baglan)
Dim dr As OleDbDataReader
cmd.Connection.Open()
dr = cmd.ExecuteReader
If dr.Read = False Then
MsgBox("Kullanıcı Adı veya Şifresi Yanlış")
dr.Close()
Else
MsgBox("Doğru Giriş Yaptınız", MsgBoxStyle.OkOnly, "Kullanıcı Girişi")
End If
dr.Close()
cmd.Connection.Close()
End Sub
End Class
Default.aspx sayfası:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Kullan�c� Ad�:"></asp:Label>
<asp:TextBox ID="txtAd" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label2" runat="server" Text="Sifre:"></asp:Label>
<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnLogin" runat="server" Text="GiriŸ" Width="64px" />
</div>
</form>
</body>
</html>
Bir makalenin daha sonuna geldik. Bir sonraki makalede görüşmek dileğiyle. Bahadır ŞAHİN
0 comments:
Yorum Gönder