I am trying to make a C# console application, I want to see my output as same as mssql format. I will take output as a csv or excell file. Could you please guide me how can I arrange my output?
SqlConnection conn = new SqlConnection("Server=sad;Database=*;User Id=*;Password=*;");
conn.Open();
string query = "select computername, version, os, from testdatabase";
SqlCommand cmd = new SqlCommand(query, conn);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
//something should be here but I dont know what
}
reader.Close();
conn.Close();