int kayitsayisi = 0;
int kayitno=0;
OleDbConnection baglanti = new OleDbConnection();
baglanti.ConnectionString = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath("yonetim/App_Data/DATABASE.mdb"));
baglanti.Open();
OleDbCommand giris = new OleDbCommand();
giris.CommandText = "SELECT COUNT(*) FROM HADIS";
giris.Connection = baglanti;
kayitsayisi =Convert.ToInt32(giris.ExecuteScalar());
Random Rnd = new Random();
kayitno = Rnd.Next(1,kayitsayisi+1);
giris.CommandText="Select * from HADIS WHERE ID="+kayitno;
giris.Connection = baglanti;
OleDbDataReader veri;
veri = giris.ExecuteReader();
veri.Read();
Response.Write(veri["HADIS"].ToString());
baglanti.Close();
seyfullah karameşe
seyfullahkaramese@hotmail.com.tr