30 MB reklamsız ASP ve ASPNET MDB destekli bir sitemiz var. Arayüzü kullanışlı.
Aşağıdaki kodları yeniden üye olduğum www.brinkster.com sitesinde denedim. Benim adresim http://tbagriyanik3.brinkster.net/ . 
 
1. BÖLÜM
 

<%@ Page Language="VB" ContentType="text/html" %>

<%@ import namespace = "system.data" %>

<%@ import namespace = "system.data.oledb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml"&gt;

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>ASP.NET</title>

<script runat="server">

Dim baglanti As New OleDbConnection

Function kayitSayisiGetir() As String

‘istatistik bilgisi iin

kayitSayisiGetir = "-"

Dim DBConnection As OleDbConnection

Dim DBCommand As OleDbCommand

Dim DBReader As OleDbDataReader

Dim SQLString As String

Dim baglantiMetni As String = "provider=microsoft.jet.oledb.4.0;data source=" & Server.MapPath("dbguestbook.mdb")

Try

DBConnection = New OleDbConnection(baglantiMetni)

DBConnection.Open()

If arama.Text = "" Then

SQLString = "SELECT count(*) FROM tablo"

Else

SQLString = "SELECT count(*) FROM tablo where ad like ‘%" + arama.Text + "%’"

End If

DBCommand =

New OleDbCommand(SQLString, DBConnection)

DBReader = DBCommand.ExecuteReader

DBReader.Read()

kayitSayisiGetir = DBReader(0).ToString

DBReader.Close()

DBConnection.Close()

Catch ex As Exception

Response.Write(" <font color=green class=’hata’>" + ex.Message + "</font><br>")

End Try

End Function

Sub page_load(ByVal obj As Object, ByVal e As EventArgs)

baglanti.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & Server.MapPath("dbguestbook.mdb")

baglanti.Open()

Dim komut As New OleDbCommand

komut.Connection = baglanti

If arama.Text = "" Then

komut.CommandText = "select * from tablo"

Else

komut.CommandText = "select * from tablo where ad like ‘%" + arama.Text + "%’"

End If

Dim adaptor As New OleDbDataAdapter

adaptor.SelectCommand = komut

Dim ds As New DataSet

adaptor.Fill(ds, "tablo")

datagrid1.DataSource = ds

datagrid1.DataBind()

If kayitSayisiGetir() = "0" Then

Response.Write("<font color=red class=’hata’>" + arama.Text + " bulunamad!</font><br>")

Else

Response.Write("<font color=blue>Kayt says=" + kayitSayisiGetir() + "</font><br>")

End If

baglanti.Close()

End Sub

Sub ekle(ByVal obj As Object, ByVal e As EventArgs)

Dim DBConnection As OleDbConnection

Dim DBCommand As OleDbCommand

Dim SQLString As String

Dim baglantiMetni As String = "provider=Microsoft.jet.OLEDB.4.0;data source=" & Server.MapPath("dbguestbook.mdb")

If passw.Text = "PAROLANIZ" Then

Try

DBConnection =

New OleDbConnection(baglantiMetni)

DBConnection.Open()

SQLString =

"Insert into tablo (ad,tel) values (‘" + ad.Text + "’,’" + tel.Text + "’)"

DBCommand =

New OleDbCommand(SQLString, DBConnection)

If (DBCommand.ExecuteNonQuery() > 0) Then

Response.Write("<font color=blue>Islem Tamam, yeni veriyi grmek iin sayfay tazeleyiniz.</font>")

Else

Response.Write("<font color=red class=’hata’>Olmad!</font>")

End If

DBConnection.Close()

Catch ex As Exception

Response.Write(" <font color=green class=’hata’>" + ex.Message + "</font><br>")

End Try

Else

Response.Write("<font color=red>Parola girilmesi gereklidir veya parola hataldr.</font>")

End If

End Sub

Sub sil(ByVal obj As Object, ByVal e As EventArgs)

Dim DBConnection As OleDbConnection

Dim DBCommand As OleDbCommand

Dim SQLString As String

Dim baglantiMetni As String = "provider=Microsoft.jet.OLEDB.4.0;data source=" & Server.MapPath("dbguestbook.mdb")

If passw.Text = "PAROLANIZ" Then

Try

DBConnection =

New OleDbConnection(baglantiMetni)

DBConnection.Open()

SQLString =

"delete from tablo where kimlik=" + kimlik.Text

DBCommand =

New OleDbCommand(SQLString, DBConnection)

If (DBCommand.ExecuteNonQuery() > 0) Then

Response.Write("<font color=blue>Islem Tamam, sayfay tazeleyiniz.</font>")

Else

Response.Write("<font color=red class=’hata’>Olmadi!</font>")

End If

DBConnection.Close()

Catch ex As Exception

Response.Write(" <font color=green>" + ex.Message + "</font><br>")

End Try

Else

Response.Write("<font color=red class=’hata’>Parola girilmesi gereklidir veya parola hataldr.</font>")

End If

End Sub

 

Reklamlar