"
The request failed with HTTP status 404: Not Found.
"
Again, this indicates an incorrect address.
[SecurityException: Requested registry access is not allowed.]
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +473
This is caused by an unauthorised user account trying to write to the event log.
MSDN says:
XmlDocument doc = new XmlDocument();
using (SqlConnection conn = new SqlConnection("...")) {
SqlCommand cmd = new SqlCommand(@"SELECT 1 FOR XML AUTO", conn);
conn.Open();
doc.Load(cmd.ExecuteXmlReader());
conn.Close();
}
CREATE PROCEDURE sp_GetInfo
AS
SELECT 123 AS Tag, 0 As Parent, p_name AS [Person!123!p_name], p_add AS [Person!123!p_add]
FROM TBL_People_Info
FOR XML EXPLICIT
GO
private SqlCommand BuildQueryCommand(string storedProcName,
IDataParameter[] parameters)
{
SqlCommand command =
new SqlCommand(storedProcName, Connection);
command.CommandType = CommandType.StoredProcedure;
foreach (SqlParameter parameter in parameters)
{
command.Parameters.Add(parameter);
}
return command;
}
protected System.Xml.XmlDocument RunProcedure(string storedProcName, IDataParameter[] parameters)
{
System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
SqlCommand cmd = BuildQueryCommand(storedProcName, parameters);
Connection.Open();
xDoc.Load(cmd.ExecuteXmlReader());
Connection.Close();
return xDoc;
}
You're then free to do what you will with the data returned. Transform it, output it in raw form, etc.
System.Xml.XmlDocument xDoc = RunProcedure("sp_GetInfo", new IDataParameter[]{});
Fixes to common .NET problems, as well as information on .NET features and solutions to common problems that are not language-specific.
Fixes to common .NET problems, as well as information on .NET features and solutions to common problems that are not language-specific.