I have an example in C# code, but it is using streamWriter
. It must be involving with FileSystemObject
rite. If yes, what are methods should I use? I want to code using VBScript WSH, and my database is MS SQL Server 2005.
Any solution, references, or guide are helpful.
using (StreamWriter tw = File.AppendText("c:\\INMS.txt"))
{
using (SqlDataReader reader = cmd.ExecuteReader())
{
tw.WriteLine("id, ip address, message, datetime");
while (reader.Read())
{
tw.Write(reader["id"].ToString());
tw.Write(", " + reader["ip"].ToString());
tw.Write(", " + reader["msg"].ToString());
tw.WriteLine(", " + reader["date"].ToString());
}
tw.WriteLine("Report Generate at : " + DateTime.Now);
tw.WriteLine("---------------------------------");
tw.Close();
reader.Close();
}
}