I tried that and I found that my problem is my TRY / CATCH / FAIL.
I'd rather have that in place then comment them out for the class to
compile. Any ideas?
Code here:
public class XMLData
{
public XMLData()
{
}
public XmlDataDocument makeXML (string lcStatement)
{
string strConnection = "SERVER=(local);Trusted_Connection=Yes ";
string strSQL = lcStatement ;
//try
//{
SqlConnection objConnection = new SqlConnection(strConnection);
SqlCommand objCommand = new SqlCommand(strSQL, objConnection);
XmlReader XmlRdr; //= new XmlTextReader();
XmlDataDocument XmlDoc; //= new XmlDataDocument();
objConnection.Open();
// create xml read to acces the xml
XmlRdr = objCommand.ExecuteXmlReader();
//XmlReader = objCommand.ExecuteXmlReader();
// move to the first content node, bypassing any schema, comments, etc.
XmlRdr.MoveToContent();
// populate xml data document
XmlDoc = new XmlDataDocument();
XmlDoc.LoadXml(XmlRdr.ReadOuterXml());
// return the document
return (XmlDoc) ;
//}
// catch
--
Stephen Russell
S.R. & Associates
Memphis TN
901.246-0159
Steve says get rid of the notat_ to send him a reply!
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:OX**************@TK2MSFTNGP09.phx.gbl...
Stephen,
Change the void to "XmlDataDocument" and it should work. The reason
it fails is the return type needs to be specified.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Stephen Russell" <srussell@notat_lotmate.com> wrote in message
news:Ou**************@TK2MSFTNGP12.phx.gbl... In the past public void has worked. But I need to return an
XMLDocument, and this class needs a string param for the SP to call.
public void makeXML (string lcStatement) wont allow me to return a doc.
I guess too many beers last night?
XmlDoc = new XmlDataDocument();
XmlDoc.LoadXml(XmlRdr.ReadOuterXml());
// return the document
return (XmlDoc) ; I bomb here.
TIA
--
Stephen Russell
S.R. & Associates
Memphis TN
901.246-0159
Steve says get rid of the notat_ to send him a reply!