J
John Tyce
My stream writer is creating the file, but writes no text in it.
if(MyDataSet.Tables["USER_QUERYTABLE"] != null)
{
MyDataSet.WriteXml(@"C:\DISWin\Report\userdata.xml");
FileStream fs = new FileStream(@"C:\DISWin\Report\userdata.xml",FileMode.Open,FileAccess.Read);
//FileStream txtFS = new FileStream(@"C:\DISWin\Report\OutPut.txt",FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
StreamWriter MyWriter = new StreamWriter(@"C:\DISWin\Report\OutPut.txt"); //(also tried passing the above FileStream her instead of path)
XmlTextReader xtr = new XmlTextReader(fs);
XmlDocument doc = new XmlDocument();
doc.Load(xtr);
XmlNodeList nodeLst;
string strCol = null;
int n = 0;
foreach(string item in mCol_Name)
{
if(item != null && item != "")
{
n = item.IndexOf(",",0);
string tag = item.Remove(n,1);
tag = tag.Trim();
nodeLst = doc.GetElementsByTagName(tag);
foreach(XmlNode node in nodeLst)
{
strCol = node.InnerText.ToString();
n = strCol.Length;
strCol = strCol.Remove(10,(n-10));
strCol = tag + " " + strCol;
MyWriter.WriteLine(strCol); (this produces no text in the output.txt file)
}
}
}
if(MyDataSet.Tables["USER_QUERYTABLE"] != null)
{
MyDataSet.WriteXml(@"C:\DISWin\Report\userdata.xml");
FileStream fs = new FileStream(@"C:\DISWin\Report\userdata.xml",FileMode.Open,FileAccess.Read);
//FileStream txtFS = new FileStream(@"C:\DISWin\Report\OutPut.txt",FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
StreamWriter MyWriter = new StreamWriter(@"C:\DISWin\Report\OutPut.txt"); //(also tried passing the above FileStream her instead of path)
XmlTextReader xtr = new XmlTextReader(fs);
XmlDocument doc = new XmlDocument();
doc.Load(xtr);
XmlNodeList nodeLst;
string strCol = null;
int n = 0;
foreach(string item in mCol_Name)
{
if(item != null && item != "")
{
n = item.IndexOf(",",0);
string tag = item.Remove(n,1);
tag = tag.Trim();
nodeLst = doc.GetElementsByTagName(tag);
foreach(XmlNode node in nodeLst)
{
strCol = node.InnerText.ToString();
n = strCol.Length;
strCol = strCol.Remove(10,(n-10));
strCol = tag + " " + strCol;
MyWriter.WriteLine(strCol); (this produces no text in the output.txt file)
}
}
}