HuntingNet.com Forums - View Single Post - 36- Team"Bro's B4 Does" Official Thread
Old 12-21-2006 | 12:12 PM
  #962  
Rob/PA Bowyer's Avatar
Rob/PA Bowyer
Boone & Crockett
 
Joined: Oct 1998
Posts: 18,322
Likes: 0
From: Hughesville, PA USA
Default RE: 36- Team"Bro's B4 Does" Official Thread

ORIGINAL: Germ



privatebool DataSetToFile(DataSet dsUsers, string fldSep, string lineSep,
string destPathName, bool overwriteIfExist)
{
StringBuilder sb = newStringBuilder();
foreach (DataRow row in dsUsers.Tables[0].Rows)
{
string line = "";
for (int i = 0; i < row.Table.Columns.Count; i++)
{
if (line.Length > 0)
{
line = line + fldSep;
}
line = line + row.ToString();
}
sb.Append(line + lineSep);
}
// clean up

dsUsers =
null;
m_sqlConn.Close();
m_sqlConn =
null;

bool exists = File.Exists(destPathName);
if (overwriteIfExist == true)
{

using (StreamWriter sw = File.CreateText(destPathName))
{
sw.Write(sb);
}

}
else

{
MessageBox.Show("File Already Exist, Please Rename");
returnfalse;

}
returntrue;
}



huh?
Rob/PA Bowyer is offline  
Reply