Hocam bağlantı ve veri çekme metodum.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
public partial class sayfa : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
OleDbConnection baglanti = new OleDbConnection();
baglanti.ConnectionString = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath("~\\App_Data\\veri.accdb"));
baglanti.Open();
if (Request.QueryString["id"] != null)
{
int sayi = Int16.Parse(Request.QueryString["id"].ToString());
OleDbCommand sorgu = new OleDbCommand();
sorgu.CommandText = ("Select * from sayfa Where id=" + sayi);
sorgu.Connection = baglanti;
OleDbDataReader oku;
oku = sorgu.ExecuteReader();
while (oku.Read())
{
Baslik.Text = oku["baslik"].ToString();
Icerik.Text = oku["icerik"].ToString();
}
}
baglanti.Close();
}
}