Şekil 6
Default.aspx.cs sayfası kodları:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
private System.Data.OleDb.OleDbConnection baglan;
private System.Data.OleDb.OleDbDataAdapter da;
private System.Data.DataSet ds;
protected void Page_Load(object sender, EventArgs e)
{
baglan = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("App_Data/veri.mdb"));
if (baglan.State == System.Data.ConnectionState.Closed)
{
baglan.Open();
}
da = new System.Data.OleDb.OleDbDataAdapter("SELECT * FROM liste", baglan);
ds = new System.Data.DataSet();
da.Fill(ds, "liste");
AdRotator1.DataSource = ds.Tables[0];
AdRotator1.ImageUrlField = "Resim";
AdRotator1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
baglan = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("App_Data/veri.mdb"));
string str;
str = "Select * From liste Where Karakter=’"+ TextBox1.Text + "’" ;
da.SelectCommand = new System.Data.OleDb.OleDbCommand(str, baglan);
System.Data.OleDb.OleDbCommandBuilder CB = new System.Data.OleDb.OleDbCommandBuilder(da);
System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand(str, baglan);
baglan.Open();
ds = new System.Data.DataSet();
System.Data.OleDb.OleDbDataReader dr;
da.Fill(ds,"liste");
dr = cmd.ExecuteReader();
while(dr.Read())
{
if (TextBox1.Text == dr.GetString(1))
{
TextBox1.Text = dr.GetString(1);
Response.Redirect("giris.aspx");
}
}
Response.Write(" < center >Uyarı: Resimdeki karakterlerle Text kutusuna yazdığınız karakterler uyuşmuyor.< /center >");
Response.Write("< center > Tekrar giriş yapınız... < /center >");
dr.Close();
baglan.Close();
}
}
giris.aspx.cs sayfası kodları:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class giris : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("< center >< b >Doğru giriş yaptınız...< /b >< /center >");
Response.Write("< br >");
Response.Write("< center >< b >Bahadır ŞAHİN...< /b >< /center >");
}
}
//Bir sonraki makalede görüşmek üzere. Bahadır ŞAHİN
Default.aspx.cs sayfası kodları:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
private System.Data.OleDb.OleDbConnection baglan;
private System.Data.OleDb.OleDbDataAdapter da;
private System.Data.DataSet ds;
protected void Page_Load(object sender, EventArgs e)
{
baglan = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("App_Data/veri.mdb"));
if (baglan.State == System.Data.ConnectionState.Closed)
{
baglan.Open();
}
da = new System.Data.OleDb.OleDbDataAdapter("SELECT * FROM liste", baglan);
ds = new System.Data.DataSet();
da.Fill(ds, "liste");
AdRotator1.DataSource = ds.Tables[0];
AdRotator1.ImageUrlField = "Resim";
AdRotator1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
baglan = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("App_Data/veri.mdb"));
string str;
str = "Select * From liste Where Karakter=’"+ TextBox1.Text + "’" ;
da.SelectCommand = new System.Data.OleDb.OleDbCommand(str, baglan);
System.Data.OleDb.OleDbCommandBuilder CB = new System.Data.OleDb.OleDbCommandBuilder(da);
System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand(str, baglan);
baglan.Open();
ds = new System.Data.DataSet();
System.Data.OleDb.OleDbDataReader dr;
da.Fill(ds,"liste");
dr = cmd.ExecuteReader();
while(dr.Read())
{
if (TextBox1.Text == dr.GetString(1))
{
TextBox1.Text = dr.GetString(1);
Response.Redirect("giris.aspx");
}
}
Response.Write(" < center >Uyarı: Resimdeki karakterlerle Text kutusuna yazdığınız karakterler uyuşmuyor.< /center >");
Response.Write("< center > Tekrar giriş yapınız... < /center >");
dr.Close();
baglan.Close();
}
}
giris.aspx.cs sayfası kodları:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class giris : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("< center >< b >Doğru giriş yaptınız...< /b >< /center >");
Response.Write("< br >");
Response.Write("< center >< b >Bahadır ŞAHİN...< /b >< /center >");
}
}
//Bir sonraki makalede görüşmek üzere. Bahadır ŞAHİN
0 comments:
Yorum Gönder