Hey,
i wanted to use XLinq in a clr function on the SQL 2005 Server. I had to register the System.Core.dll and System.XML.Linq.dll to deploy the function. Then i tried to start the function. There i did get this error message:
Msg 6522, Level 16, State 1, Line 2
A .NET Framework error occurred during execution of user-defined routine or aggregate "test":
System.MissingMethodException: Method not found: 'Void System.Xml.XmlReaderSettings.set_MaxCharactersFromEntities(Int64)'.
System.MissingMethodException:
at System.Xml.Linq.XNode.GetXmlReaderSettings(LoadOptions o)
at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
at StoredProcedures.test()
I thought i also had to register the System.XML.dll on the server but it was already there.
"System.MissingMethodException: Method not found: 'Void System.Xml.XmlReaderSettings.set_MaxCharactersFromEntities(Int64)'."
This function is part of the System.XML.dll from 2.xx framework.
My Project is created and compiled with VS 2008 and the Framework 3.5.
Here a little test-function which shows the error:
[Microsoft.SqlServer.Server.
SqlFunction(SystemDataAccess = SystemDataAccessKind.Read)]
public static SqlString test()
{
using (SqlConnection conn = new SqlConnection("context connection = true"))
{
string temp = "";
XDocument doc = XDocument.Load("\\\\cmhmd23019\\test\\UNIT_472901S0003602_20080703122622.xml");
var schemaname_temp =
from element in doc.Elements("Schema").Attributes("name")
select new { element.Value };
foreach (var a in schemaname_temp)
{
temp = a.Value;
}
SqlString
temp2 = temp;
return temp2;
}
}
Any Suggestions?
Greets Kamei