Hey guys,
I'm getting a problem in my project, before I upgrade my database to v12 my webapp worked perfectly, but after, every time that I execute query to show a column in a dropdownlist I receive this message "The data reader has more than one field. Multiple fields are not valid for EDM primitive or enumeration types.".
Actually, everytime when I try to read the DataBase, I receive this message. Independent what I'm trying to do
Someone had the same problem, or something like that?
Threre is my code. ApplicationDbContext context = new ApplicationDbContext();
string user = User.Identity.GetUserId();
System.Collections.Generic.List<SelectListItem> Devices = new System.Collections.Generic.List<SelectListItem>();
var sqlcmd = "SELECT Nick FROM dbo.AspNetDevice WHERE OwnerID = '" + user + "' ORDER BY Nick ASC";
context.Database.Connection.Open();
try
{
var GetDevice = context.Database.SqlQuery<string>(sqlcmd);
int count = GetDevice.Count(); int i = 0;
if (count > 0)
{
Devices.Add(new SelectListItem { Text = "Selecione o Dispositivo", Selected = true, Disabled = true });
while (i != count)
{
Devices.Add(new SelectListItem { Value = GetDevice.ElementAt(i), Text = GetDevice.ElementAt(i) });
i++;
}
}else
{
Devices.Add(new SelectListItem { Text = "Adicione um Dispositivo", Selected = true, Disabled = true });
}
}
finally
{
context.Database.Connection.Close();
}
- Edited by Felipe Suardi 13 hours 53 minutes ago


