string connectionString = ConfigurationManager.ConnectionStrings["Connectionstring"].ConnectionString;
SqlConnection sqlConnection = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand();
SqlDataReader reader;
cmd.CommandText = "select * from customers";
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlConnection;
sqlConnection.Open();
reader = cmd.ExecuteReader();
fileOutput.AutoFlush = true;
fileOutput.Write(reader[i].ToString() + "\t");
}
}
fileOutput.Write("\n");
}
}
sqlConnection.Close();
}
when i write the above and run in excel data will be download as follows
1 suresh 988789899 chennai IN 1
2 rajeshr 988788799 chennai IN 2
3 mootrhi 988787699 chennai Out 3
select * from customers records as follows
id Name Mobile Place Type Cityid
1 suresh 988789899 chennai IN 1
2 rajeshr 988788799 chennai IN 2
3 mootrhi 988787699 chennai Out 3
but in excel the above column name is not coming in excel when i download.
id Name Mobile Place Type Cityid
the above column name is not showing in excel when i download.
what is the mistake in my above code.