Nargzul
asked on
Problem with LINQ to entities on a XML field in database
I've a problem:
I try to access to a database with the code below, but I've an error:
System.Data.EntityCommandE xecutionEx ception: Une erreur s'est produite lors de l'exécution de la définition de la commande. Pour plus de détails, consultez l'exception interne. ---> System.Data.SqlClient.SqlE xception: Disallowed implicit conversion from data type xml to data type nvarchar, table 'dbo.Fournisseurs', column 'Informations'. Use the CONVERT function to run this query.
I think it's the database that say this error, but what can I do? Because I'm using Linq to Entity, It's not me who write this query.
I try to access to a database with the code below, but I've an error:
System.Data.EntityCommandE
I think it's the database that say this error, but what can I do? Because I'm using Linq to Entity, It's not me who write this query.
using (geststockEntities gse = new geststockEntities("name=geststockEntitiesTechnicien"))
{
IQueryable<Fournisseurs> fourns = gse.Fournisseurs.Where(f => f.Informations.Contains(prefixText));
res = new String[fourns.Count()];
int i = 0;
foreach (Fournisseurs f in fourns)
{
XElement fournisseur = XElement.Parse(f.Informations.ToString());
res[i++] = fournisseur.Element("nom") + " (ID #" + f.ID_fournisseur + ")";
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.