IF you have a MOSS list that contains a lot of data including UserID's. These ID's are stored in the Users table in SQL because the site is working by Forms authentication provider.
we need to display a specific result from this list in a grid including the user names not the IDs.
we have a lot of solutions for doing that:
- loop to every row and send this ID to a stored which returns the user name (Don't loop to SQL -very very bad performance-)
-Concatenating these ID's together and form a static select statement to be sent to the SQL and executed (very bad performance because this statemnet is not compiled, note that the "in" statment doesn't accept parameters so it can't be stored procedure) "select UserName from Users where UserId in (12,45,465,5,56,78,89,90)".
- Use Linque to join different data sources (Good solution)
- User SQL 2008: where you can create a stored procedure with parameters of type table. (then we can create a table in .net including the IDs and then send this table as a parameter to the stored procedure.)
- Use Open XML in SQL 2005, where you can format XML string and pass this XML to a stored procedure to read it as a table and then join this virtual table to the users table.
Ahmed Abdel Hameed (MCSD .Net)