Currently i'm working on Lucky Draw System. I've already can call out the data from database and display it using label. But how can i make it display one by one in label to make the system more interesting.
This is my code :
- using System;  
- using System.Collections.Generic;  
- using System.Configuration;  
- using System.Data;  
- using System.Data.SqlClient;  
- using System.IO;  
- using System.Linq;  
- using System.Web;  
- using System.Web.UI;  
- using System.Web.UI.WebControls;  
-   
-   
-   
-   
- public partial class _Default : System.Web.UI.Page  
-       
- {  
-     string constr = ConfigurationManager.ConnectionStrings["lucky"].ConnectionString;  
-     protected void Page_Load(object sender, EventArgs e)  
-     {  
-   
-   
-     }  
-   
-     protected void Button1_Click(object sender, EventArgs e)  
-     {  
-         string query = "SELECT TOP 1[EMP_ID]FROM EMPLOYEES WHERE[Attendance] = 'Present'ORDER BY NEWID()";  
-   
-         using (SqlConnection con = new SqlConnection(constr))  
-         {  
-             using (SqlCommand cmd = new SqlCommand(query))  
-             {  
-                 using (SqlDataAdapter sda = new SqlDataAdapter())  
-                 {  
-                     cmd.Connection = con;  
-                     sda.SelectCommand = cmd;  
-                     using (DataTable dt = new DataTable())  
-                     {  
-                         sda.Fill(dt);  
-                         if (dt.Rows.Count > 0)  
-                         {  
-                               
-                                     Label1.Text = dt.Rows[0]["EMP_ID"].ToString();  
-   
-                         }  
-                         else  
-                         {  
-                             Label1.Text += "Cannot draw! ";  
-                         }  
-                     }  
-                 }  
-             }  
-         }  
-     }  
- }  
-