Thanks for the reply. I did check that and it appears to be loaded by the browser. After further review, I believe there is an issue with obtaining the XML string from the database...
The function I have written in the .cs is returning the data from the database, but when I attempt to populate my string, nothing is returned... Seems rather basic, not sure why it wouldn't be working. Seems to be an issue with the last piece in the .cs: strXML = dt.Rows[0][0].ToString();
I've returned Rows.Count.ToString() and it appears that the DataTable is populating, but for some reason attempting to populate strXML with that data is not working. Is there some syntax in DNN that I'm not familiar with that differs from my function (that works) in Visual Studio? Many thanks in advance.
Code:
public string Sparks(string Section, string Report, string Identifier)
{
DataTable dt = null;
SqlConnection cn = null;
SqlCommand cmd = null;
SqlDataReader reader = null;
string SQL = "";
string strXML = "";
string CnString = "";
try
{
// build query
SQL = "EXEC InsertGenericProcNameHere 0";
SQL += ",'" + Section;
SQL += "','" + Report;
if (Identifier == "")
SQL += "',NULL";
else
SQL += "','" + Identifier + "'";
SQL += ",NULL";
// create connection string
CnString = System.Configuration.ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString;
// create & open connection
cn = new SqlConnection(CnString);
cn.Open();
// create command
cmd = new SqlCommand(SQL, cn);
cmd.CommandTimeout = 60;
// obtain results from query
reader = cmd.ExecuteReader(CommandBehavior.SingleResult);
// populate datatable with results
dt = new DataTable();
dt.Load(reader);
dt.AcceptChanges();
// ensure the datatable has returned a result,
// if so, set string to result
if (dt != null && dt.Rows.Count > 0)
strXML = dt.Rows[0][0].ToString();
}
catch (Exception ex)
{
// log error here
}
return strXML;
}