asp.net sayfaya veritabanı bağlama -3

kanisti

New member
Katılım
14 Ağu 2008
Mesajlar
23
Reaction score
0
Puanları
0
Yaş
42
Kod:
<%@ Import Namespace="System.Data.OleDb" %>
<Script Language="C#" RunAt="Server">
    private void Page_Load(object sender, System.EventArgs e)
    {
    OleDbConnection Connection01;
    Connection01=new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0; Data Source="
        +Server.MapPath("WebApp01_Database/PersonalDatabase.mdb"));
    Connection01.Open();
    OleDbCommand Command01;
    Command01=new OleDbCommand("[COLOR="SeaGreen"][I]SELECT Name,Surname FROM PersonalInfo[/I][/COLOR]", Connection01);
    OleDbDataReader DataReader01;
    DataReader01=Command01.ExecuteReader();
    Response.Write("<html><head><title>WebApplication01 is Running!...</title></head><body><center>");
    Response.Write("<h1>ASP.NET Database Development</h1>");
    while(DataReader01.Read())
    {
      Response.Write(DataReader01["Name"].ToString()+" "+DataReader01["Surname"].ToString()+"<br>");
    }
    Response.Write("</center></body></html>");
    DataReader01.Close();
    Connection01.Close();
    }
</Script>
[COLOR="Red"]
Önizleme :[/COLOR] webapp01_default.aspx
 
Geri
Üst