ah ok sorry didn't read all the posts. ExecuteScalar will only return one result.
Use a datareader instead which will loop through all rows in the returned data.
Replace Column1 etc with the field names from your database and remember to close your datareader and database connection.Code:SqlDataReader dr; dr = command.ExecuteReader(); while(dr.Read()) { this.label1.Text = dr["Column1"].ToString(); //or this.label2.Text = dr.GetString(dr.GetOrdinal("Column2")); //etc }




Reply With Quote