ListView, Repeater veri gelmiyor

mfi

Profesör
Yazilar.aspx kodu:
Kod:
 int gelenId = int.Parse(Request.QueryString["yaziId"]);        SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database.mdf;Integrated Security=True;User Instance=True");
        SqlCommand cmd = new SqlCommand("select * from Yazilar where yaziId=" + gelenId, con);
        con.Open();
        cmd.ExecuteScalar().ToString();


        con.Close();
        DataTable dt = new DataTable();
        ListView1.DataSource = dt;
        ListView1.DataBind();
        dt.Clear();
        con.Dispose();

Yazilar.aspx Source Kod:
Kod:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Yazilar.aspx.cs" Inherits="Yazilar" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<asp:ListView ID="ListView1" runat="server">
         
            <ItemTemplate>
                
                <div style="border:solid 1px black;background-color:White">
                
               <h1 ><%# Eval("yaziBaslik")%></h1>
               <br />
                <a href="Yazilar.aspx?yaziId=<%#Eval("yaziId") %>">
                 <br />
                 <asp:Image ID="Image1" ImageUrl='<%# "images/"+ Eval("resim") %>' runat="server" width="550" height="250" />
                        <br />
                  
                <%# Eval("yazi")%>
                </div>
                 </ItemTemplate>
        </asp:ListView>


</asp:Content>

not: bu kodların aynısını default.aspx de kullanıyorum bir sorun çıkmıyor. acil yardım ltfn. sadece 1 saatim kaldı

tmm beyler sorunu su kodlarla çözdüm :D

int gelenId = int.Parse(Request.QueryString["yaziId"]);

SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database.mdf;Integrated Security=True;User Instance=True");
con.Open();
SqlDataAdapter da = new SqlDataAdapter("select * from Yazilar where yaziId=" + gelenId, con);


DataTable dt = new DataTable();
da.Fill(dt);
ListView1.DataSource = dt;
ListView1.DataBind();
dt.Clear();
con.Close();
 
Üst