string j = "Data Source=FUJITSU-PC\\SQLEXPRESS;Initial Catalog=attendance_system;Integrated Security=True";
DataTable dt = new DataTable();
using (SqlConnection cn = new SqlConnection(j))
{
SqlCommand cmd = new SqlCommand("select dbo.faculty_status.username from dbo.faculty_status", cn);
cn.Open();
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
dt.Load(dr);
cn.Close();
}
int x = dt.Rows.Count;
foreach (DataRow row in dt.Rows)
{
foreach (var item in row.ItemArray)
{
string xx = item.ToString();
}
}
I used this code it wors but it does not show me my desire first row value it givs me out put like----
13-24516-2