Witam
Probuje wyswietlic dane w gridview z zapytania. Z tym ze chcialbym wyswietlic oddzielnie dane w labelu i oddzielnie w gridview. Ale niestety kod nie dziala. Wyswietla mi tylko tekst w labelu, natomiast w gridview juz nie. Prosze o pomoc.
public partial class Tresc : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ledCS"].ConnectionString);
myConnection.Open();
QueryStringParameter query = new QueryStringParameter();
query.Name = "Param";
query.QueryStringField = "IdArtykulu";
SqlCommand myCommnad = new SqlCommand("Select Tytul,Tresc from Artykuly where IdArtykulu="+Request.QueryString["IdArtykulu"], myConnection);
SqlDataReader myReader;
myReader = myCommnad.ExecuteReader();
myReader.Read();
if (myReader.HasRows)
{
tytul.Text = myReader[0].ToString();
}
grid2.DataSource = myReader;
grid2.DataBind();
myReader.Close();
myConnection.Close();