Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Stream Writer not populating

$
0
0

I am running this code, but when I hit the foreach loop it never writes any data just closes the connection and moves on...What do I need to alter?'

SqlCommand cmd = new SqlCommand(QS, con);
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
//logfile is declared earlier in the code and exists
StreamWriter sw = new StreamWriter(logfile);
//This is where it hits but never writes anything
foreach (DataRow in ds.Tables[0].Rows
{
//Do stuff
}


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>