does anyone konw why is this code giving an error saying:
There is already an open DataReader associated with this Command which must be closed first.
the error is coming form the place where i have cold the line
the code is below:
C# Syntax
public String[] LoadUSEmp()
{
String firstName;
String lastName;
int NoOfRows;
db.openConnection();
String query = @"Select FirstName,LastName From Employee Where Citizenship = 'US' Order by FirstName ";
SqlCommand comm = new SqlCommand(query, DB.getConnection());
SqlDataAdapter da1 = new SqlDataAdapter(comm);
DataTable dt1 = new DataTable();
[B] da1.Fill(dt1);[/B]
NoOfRows = dt1.Rows.Count;
String[] fullName = new String[NoOfRows];
for (int i = 0; i < dt1.Rows.Count; i++)
{
firstName = dt1.Rows[i]["FirstName"].ToString();
lastName = dt1.Rows[i]["LastName"].ToString();
fullName[i] = firstName + " " + lastName;
}
comm.Dispose();
db.closeConnection();
return fullName;
}
i need help thanxxxxxxxxxxx