Actually I have an application in that I'm reading Stream data using StreamReader line to line and Inserting into Data Base If any Case Internet Connection Closed or system shutdown then i want to resume Stramreader don't want to read from starting Position of the Stream.
- Stream stream = res.GetResponseStream();
- using (StreamReader sr = new StreamReader(stream))
- {
- int i = 1;
- int j = 0;
- string ss = "";
- List<string> strContent = new List<string>();
- while (i > j)
- {
- StringBuilder sb = new StringBuilder();
- while (!sr.EndOfStream)
- {
- string line = sr.ReadLine();
- ss = ss + line;
- i++;
- if (line.Equals(""))
- {
- if ((sr.EndOfStream))
- {
- }
- else
- {
- ss = ss + "";
- }
- var mySourceDoc = new XmlDocument();
- //load the file from the stream
- mySourceDoc.LoadXml(ss);
- //XmlNode nd = mySourceDoc.DocumentElement.SelectSingleNode("//records");
- XmlDocument xmlAPDP = new XmlDocument();
- xmlAPDP.LoadXml(ss);
- XmlNodeReader xmlReader = new XmlNodeReader(xmlAPDP);
- DataSet dataSet = new DataSet();
- dataSet.ReadXml(xmlReader);
- string sds = WriteXML(dataSet);
- ss = "";
- ss = "
" ; - j = i;
- i = j + 1;
- break;
- }
- }
- if ((sr.EndOfStream))
- {
- break;
- }
- }
- }

Salman BegPosted Feb 21, 2019, 2:39 AM
Amit GuptaPosted Feb 21, 2019, 1:59 AM