When I run my code on debug I get this error:
Conversion failed when converting from a string to a uniqueidentifier
Here is the code:
public class UserObject
{
private string m_name = string.Empty;
public UserObject(string id)
{
#region Internal Logic
try
{
using (SqlConnection cn = new SqlConnection(SiteConfig.ConnectionString))
{
string sSQL = "SELECT [UserName] FROM [aspnet_users] WHERE [UserID] = @UserID";
using (SqlCommand cm = new SqlCommand(sSQL, cn))
{
cm.Parameters.AddWithValue("@UserID", id);
cn.Open();
using (SqlDataReader rd = cm.ExecuteReader())
{
while (rd.Read())
{
m_name = rd[0].ToString();
}
rd.Close();
}
cn.Close();
}
}
}
catch (Exception ex)
{
}
#endregion Internal logic
}
}