none
veritabanından gelen tarihi göstermiyor... RRS feed

  • Soru

  • ne yapmalıyım?
    protected void rptLastBlog_ItemCommand(object source, RepeaterCommandEventArgs e)
    	{
    		if (e.CommandName == "title")
    		{
    			rptBlog.Visible = false;
    			plBlog.Visible = true;
    			string conStr = ConfigurationManager.ConnectionStrings["CS"].ToString();
    			SqlConnection conn = new SqlConnection(conStr);
    			SqlCommand cmd = new SqlCommand("select * from Blog where ID=" + e.CommandArgument, conn);
    			try
    			{
    				conn.Open();
    				SqlDataReader reader = cmd.ExecuteReader();
    				DateTime dt = new DateTime();
    				while (reader.Read())
    				{
    					lblDay.Text = String.Format("{0:dd}", dt, reader["AddDate"].ToString());
    					lblMonth.Text = String.Format("{0:MMM}", dt, reader["AddDate"].ToString());
    					lblBlogTitle.Text = reader["BlogTitle"].ToString();
    					lblBlogText.Text = reader["BlogText"].ToString();
    				}
    				reader.Close();
    			}
    			catch (Exception ex)
    			{
    				lblW.ForeColor = Color.Red;
    				lblW.Text = "Bir hata oluştu!<br/>" + ex.Message;
    			}
    			finally
    			{
    				conn.Close();
    			}
    		}
    		else
    		{
    			lblW.Text = "Gösterilecek veri yok.";
    		}
    	}


    1881-193∞
    mkayar86[at]gmail[nokta]com
    www.facebook.com/mkayar86
    http://www.twitter.com/kayarmelih

    24 Kasım 2013 Pazar 18:28

Yanıtlar

Tüm Yanıtlar