Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Collections;
- using System.Data.SqlClient;
- namespace eDziennik1
- {
- public partial class Default : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- Label2.Text = " ";
- string connetionString = null;
- SqlConnection conn;
- connetionString = "Data Source=.\\SQLEXPRESS;Initial Catalog=tomass;Integrated Security=True";
- conn = new SqlConnection(connetionString);
- conn.Open();
- string result = "SELECT Ocena FROM Oceny";
- SqlCommand showresult = new SqlCommand(result, conn);
- List<int> list = new List<int>();
- using (var reader = showresult.ExecuteReader())
- {
- while (reader.Read())
- {
- list.Add(reader.GetInt32(0));
- }
- }
- for (int i = 0; i < list.Count; i++)
- {
- if (i == list.Count - 1)
- {
- Label2.Text += list[i];
- }
- else
- {
- Label2.Text += list[i] + ", ";
- }
- }
- conn.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement