B
binder
How do I eliminate an extra backslash that is appearing after LoadXML
call?
This issue is causing an error with Process.Start.
I have a string stored in sql: c:\program files\internet
explorer\iexplore.exe
If I look at this data when I write the dataset to an XML file, the
data is correct.
After the LoadXML call, the data is hosed.
Notice in my commandlocation node, all of the backslashes are doubled.
I don't know if the problem is in the ds.GetXml() call or the
xd.LoadXml() call.
"<NewDataSet>
<VendorAction>
<commandlocation>c:\\program files\\internet
explorer\\iexplore.exe</commandlocation>
<commandarguments>http://ServerName/mm/integration/context.aspx?PatientName=
{PatientName}
</commandarguments>
<commanddescription>Launch SmartID Works Oncology
Product</commanddescription>
</VendorAction>
</NewDataSet>"
My code:
//Add the parameter to the Command's Parameters
collection
cmd.Parameters.Add(vaid);
// Create the DataSet & DataAdapter
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds, "VendorAction");
// Write DataSet as XML file
ds.WriteXml(@"C:\VAIDOutput.xml");
*** Data Correct Here ***
// Load DataSet as XML document to return to caller
xd.LoadXml(ds.GetXml());
conn.Close();
*** Data Error Here ***
If I use double backslashes in the original string in sql:
c:\\program files\\internet explorer\\iexplore.exe
then the result from the LoadXml call is quadruple backslashes:
c:\\\\program files\\\\internet explorer\\\\iexplore.exe
Where and how should this be changed
call?
This issue is causing an error with Process.Start.
I have a string stored in sql: c:\program files\internet
explorer\iexplore.exe
If I look at this data when I write the dataset to an XML file, the
data is correct.
After the LoadXML call, the data is hosed.
Notice in my commandlocation node, all of the backslashes are doubled.
I don't know if the problem is in the ds.GetXml() call or the
xd.LoadXml() call.
"<NewDataSet>
<VendorAction>
<commandlocation>c:\\program files\\internet
explorer\\iexplore.exe</commandlocation>
<commandarguments>http://ServerName/mm/integration/context.aspx?PatientName=
{PatientName}
</commandarguments>
<commanddescription>Launch SmartID Works Oncology
Product</commanddescription>
</VendorAction>
</NewDataSet>"
My code:
//Add the parameter to the Command's Parameters
collection
cmd.Parameters.Add(vaid);
// Create the DataSet & DataAdapter
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds, "VendorAction");
// Write DataSet as XML file
ds.WriteXml(@"C:\VAIDOutput.xml");
*** Data Correct Here ***
// Load DataSet as XML document to return to caller
xd.LoadXml(ds.GetXml());
conn.Close();
*** Data Error Here ***
If I use double backslashes in the original string in sql:
c:\\program files\\internet explorer\\iexplore.exe
then the result from the LoadXml call is quadruple backslashes:
c:\\\\program files\\\\internet explorer\\\\iexplore.exe
Where and how should this be changed