protected void LinkButton2_Command(object sender, CommandEventArgs e)
    {
        Response.Redirect("sözlük.aspx?id=" + e.CommandArgument.ToString());
        OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" + @"data source=C:\Users\user\Downloads\WebSite2\WebSite2\sozluk.mdb");

        con.Open();
        string           sql = "Select y.yorum,k.kullaniciadi from yorumlar y,kullanicilar k where k.kullanicino=y.kullanicino and y.konuno=" + e.CommandArgument.ToString();
        OleDbDataAdapter t   = new OleDbDataAdapter(sql, con);
        DataTable        d   = new DataTable();

        t.Fill(d);
        Rpt2.DataSource = d;
        Rpt2.DataBind();
        sbaslik.Text = ((LinkButton)sender).Text;
        if (sbaslik.Text != "")
        {
            Panel1.Visible = true;
        }
        con.Close();



        // Rpt2.DataSource = b;
        // Rpt2.DataBind();

        //    Button b = new Button();
        //b.Width = 100;
        //b.Height = 50;
        //b.Text = "dsadasd";
        //Panel a=(Panel)Rpt2.FindControl("Panel1");
        //a.Controls.Add(b);

        // HtmlGenericControl mydiv = (HtmlGenericControl)Rpt2.FindControl("dede");
        //mydiv.Controls.Add(b);
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string          kelime = Request.QueryString["q"].ToString();
        OleDbConnection con    = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" + "data source=sozluk.mdb");

        con.Open();
        OleDbCommand cmd = new OleDbCommand();

        cmd.CommandText = "Select konubaslik from konular where konubaslik like '%" + kelime + "%'";

        cmd.Connection  = con;
        cmd.CommandType = CommandType.Text;
        OleDbDataReader dr;

        dr             = cmd.ExecuteReader();
        rpt.DataSource = dr;
        rpt.DataBind();
        dr.Close();

        OleDbConnection cony = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" + "data source=sozluk.mdb");

        cony.Open();
        OleDbCommand cmdy = new OleDbCommand();

        cmdy.CommandText = "Select yorum from yorumlar where yorum like '%" + kelime + "%'";
        cmdy.Connection  = con;
        cmdy.CommandType = CommandType.Text;
        OleDbDataReader dry;

        dry             = cmdy.ExecuteReader();
        Rpt2.DataSource = dry;
        Rpt2.DataBind();
        dry.Close();
    }
    void paylasimsec(string a)
    {
        OleDbConnection con2 = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" + @"data source=C:\Users\user\Downloads\WebSite2\WebSite2\sozluk.mdb");

        con2.Open();
        OleDbCommand cmd2 = new OleDbCommand();

        cmd2.CommandText = "Select y.yorumno ,y.yorum,kul.kullaniciadi from kullanicilar kul,yorumlar y where y.kullanicino=kul.kullanicino and y.konuno=" + a;
        cmd2.Connection  = con2;
        cmd2.CommandType = CommandType.Text;
        OleDbDataReader dr2;

        dr2 = cmd2.ExecuteReader();
        //while (dr.Read())
        // {
        if (Session["kulno"] != null)
        {
            Panel1.Visible = true;
        }
        Rpt2.DataSource = dr2;

        Rpt2.DataBind();
        con2.Close();
    }