E-Okul – ASP.NET

E-Okul – ASP.NET

a0

giris.aspx Kodları;

[code lang=”html”]

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="giris.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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>E-Ömer</title>
<style type="text/css">
<!–
body {
background-image: url(resim/arka.png);
}
.style2
{
height: 32px;
}
.style4
{
height: 2px;
}
.style7
{
height: 14px;
}
.style8
{
height: 24px;
}
.style9
{
height: 15px;
}
.style10
{
height: 12px;
}
–>
</style></head>

<body bgcolor="#ffffff">
<form id="form1" runat="server">
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="742" height="175" border="0">
<tr>
<td width="313" height="169">&nbsp;</td>
<td background="resim/giris.png">
<table border="0"
style="width: 256px; height: 195px">
<tr>
<td width="12" class="style8"></td>
<td width="215" class="style8">T.C Kimlik No:</td>
</tr>
<tr>
<td colspan="2" class="style7">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox1" runat="server" BackColor="#FBFBFB"
BorderStyle="None" Width="192px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style10"></td>
<td class="style10">Öğrenci No</td>
</tr>
<tr>
<td colspan="2" class="style9">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox2" runat="server" BackColor="#FBFBFB"
BorderStyle="None" Width="204px"></asp:TextBox>
&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="style2">&nbsp;&nbsp;&nbsp;&nbsp;
<asp:LinkButton ID="LinkButton1" runat="server"
PostBackUrl="~/yönetimbilgi.aspx">Yönetim Bilgi Sistemi</asp:LinkButton>
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button1" runat="server" Text="giriş" />
<asp:Label ID="Label1" runat="server"></asp:Label>
</td>
</tr>

<tr>
<td colspan="2" class="style4"></td>
</tr>

</table></td>
<td width="142">&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

[/code]

giris.aspx.vb Kodları;

[code lang=”html”]

Imports System.Data
Imports System.Data.OleDb
Partial Class _Default
Inherits System.Web.UI.Page
Dim baglanti As New OleDbConnection("Provider=Microsoft.ACE.OleDB.12.0;Data Source=" & Server.MapPath("App_Data\ders.accdb"))
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim kadi As String = TextBox1.Text
Dim sifre As String = TextBox2.Text
Dim adp As New OleDbDataAdapter("select * from uyeler where kul_adi=’" & kadi & "’ and sifre=’" & sifre & "’", baglanti)
Dim dt As New DataTable
adp.Fill(dt)
Dim i As Integer = 0
For Each satir In dt.Rows
i += 1
Session("Kimlik") = satir(0)
Session("ad") = satir(1)
Session("soyad") = satir(2)
Session("yetki") = satir(8)
Next
If i = 0 Then
Label1.Text = "kullanıcı adı ve şifre hatalı"
Else
Response.Redirect("ogrencinotları.aspx")
End If

End Sub
End Class

&nbsp;

[/code]

a1

ogretmenekle.aspx Kodları;

[code lang=”html”]

<%@ Page Language="VB" MasterPageFile="~/admin.master" AutoEventWireup="false" CodeFile="ogretmenekle.aspx.vb" Inherits="ogretmenekle" title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">

.style3
{
width: 146px;
}
.style11
{
height: 32px;
width: 110px;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table style="width:100%;">
<tr>
<td class="style11">
Ad</td>
<td class="style3">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style11">
Soyad</td>
<td class="style3">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style11">
Branş</td>
<td class="style3">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style11">
<asp:Button ID="Button2" runat="server" Text="Kaydet" />
</td>
<td class="style3">
<asp:Label ID="Label2" runat="server"></asp:Label>
</td>
<td>
&nbsp;</td>
</tr>
</table>
</asp:Content>

[/code]

ogretmenekle.aspx.vb Kodları;

[code lang=”vb”]

Imports System.Data
Imports System.Data.OleDb
Partial Class ogretmenekle
Inherits System.Web.UI.Page
Dim baglanti As New OleDbConnection("Provider=Microsoft.ACE.OleDB.12.0;Data Source=" & Server.MapPath("App_Data\ders.accdb"))
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
baglanti.Open()
Dim cmd As New OleDbCommand
cmd.CommandText = "insert into ogretmenekle(adi,soyadi,brans)values(@adi,@soyadi,@brans)"
cmd.Connection = baglanti
cmd.Parameters.Add("@adi", OleDbType.VarChar).Value = TextBox1.Text
cmd.Parameters.Add("@soyadi", OleDbType.VarChar).Value = TextBox2.Text
cmd.Parameters.Add("@brans", OleDbType.VarChar).Value = TextBox3.Text
cmd.ExecuteNonQuery()
Label2.Text = "Öğretmen eklendi"
baglanti.Close()
Catch ex As Exception
Label2.Text = "Öğretmen eklenemedi"
End Try
End Sub
End Class

[/code]

a2

ogrenciekle.aspx Kodları;

[code lang=”html”]

<%@ Page Language="VB" MasterPageFile="~/admin.master" AutoEventWireup="false" CodeFile="ogrenciekle.aspx.vb" Inherits="ogrenciekle" title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table style="width:100%;">
<tr>
<td class="style2">
Adı</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style2">
Soyadı</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style2">
Sınıf</td>
<td>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style2">
T.C No</td>
<td>
<asp:TextBox ID="TextBox4" runat="server" MaxLength="11"></asp:TextBox>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style2">
Okul No</td>
<td>
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style2">
&nbsp;</td>
<td>
<asp:Button ID="Button1" runat="server" Text="Ekle" />
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style2">
&nbsp;</td>
<td>
<asp:Label ID="Label1" runat="server"></asp:Label>
</td>
<td>
&nbsp;</td>
</tr>
</table>
</asp:Content>

&nbsp;

[/code]

 

[code lang=”vb”]

Imports System.Data
Imports System.Data.OleDb
Partial Class ogrenciekle
Inherits System.Web.UI.Page
Dim baglanti As New OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=" & Server.MapPath("app_data/ders.accdb"))
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
baglanti.Open()
Dim cmd As New OleDbCommand
cmd.Connection = baglanti
cmd.CommandText = "insert into ogrenciekle(adi,soyadi,sinif,tcno,okulno) values (@adi,@soyadi,@sinif,@tcno,@okulno)"
cmd.Parameters.Add("@adi", OleDbType.VarChar).Value = TextBox1.Text
cmd.Parameters.Add("@soyadi", OleDbType.VarChar).Value = TextBox2.Text
cmd.Parameters.Add("@sinif", OleDbType.VarChar).Value = TextBox3.Text
cmd.Parameters.Add("@tcno", OleDbType.VarChar).Value = TextBox4.Text
cmd.Parameters.Add("@okulno", OleDbType.VarChar).Value = TextBox5.Text
cmd.ExecuteNonQuery()
Label1.Text = "Öğrenci Ekleme Başarılı"
baglanti.Close()
End Sub
End Class

[/code]

a4

ogrencisil.aspx Kodları;

[code lang=”html”]

<%@ Page Language="VB" MasterPageFile="~/admin.master" AutoEventWireup="false" CodeFile="ogrencisil.aspx.vb" Inherits="ogrencisil" title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\ders.accdb;Persist Security Info=True"
DeleteCommand="DELETE FROM [ogrenciekle] WHERE [id] = ?"
InsertCommand="INSERT INTO [ogrenciekle] ([id], [adi], [soyadi], [sinif], [tcno], [okulno]) VALUES (?, ?, ?, ?, ?, ?)"
ProviderName="System.Data.OleDb" SelectCommand="SELECT * FROM [ogrenciekle]"
UpdateCommand="UPDATE [ogrenciekle] SET [adi] = ?, [soyadi] = ?, [sinif] = ?, [tcno] = ?, [okulno] = ? WHERE [id] = ?">
<DeleteParameters>
<asp:Parameter Name="id" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="adi" Type="String" />
<asp:Parameter Name="soyadi" Type="String" />
<asp:Parameter Name="sinif" Type="String" />
<asp:Parameter Name="tcno" Type="String" />
<asp:Parameter Name="okulno" Type="String" />
<asp:Parameter Name="id" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="id" Type="Int32" />
<asp:Parameter Name="adi" Type="String" />
<asp:Parameter Name="soyadi" Type="String" />
<asp:Parameter Name="sinif" Type="String" />
<asp:Parameter Name="tcno" Type="String" />
<asp:Parameter Name="okulno" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="id" DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="id" HeaderText="id" InsertVisible="False"
ReadOnly="True" SortExpression="id" />
<asp:BoundField DataField="adi" HeaderText="adi" SortExpression="adi" />
<asp:BoundField DataField="soyadi" HeaderText="soyadi"
SortExpression="soyadi" />
<asp:BoundField DataField="sinif" HeaderText="sinif" SortExpression="sinif" />
<asp:BoundField DataField="tcno" HeaderText="tcno" SortExpression="tcno" />
<asp:BoundField DataField="okulno" HeaderText="okulno"
SortExpression="okulno" />
</Columns>
</asp:GridView>
</asp:Content>

[/code]

Siteyi İNDİR

 

Yorumlar 10

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir