// I want to use the SQL Query SELECT * FROM Table here, how can I do that?
string filepath = Server.MapPath("test.doc");
FileInfo file = new FileInfo(filepath);
// Checking if file exists
if (file.Exists)
{
// Clear the content of the response
Response.ClearContent();
// LINE1: Add the file name and attachment, which will force the open/cance/save dialog to show, to the header
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
// Add the file size into the response header
Response.AddHeader("Content-Length", file.Length.ToString());
// Set the ContentType
Response.ContentType = ReturnExtension(file.Extension.ToLower());
// Write the file into the response (TransmitFile is for ASP.NET 2.0. In ASP.NET 1.1 you have to use WriteFile instead)
Response.TransmitFile(file.FullName);
// End the response
Response.End();
}
Может ли кто-нибудь помочь мне с получением содержимого таблицы с именем Table в SQL Server 2008 и ее загрузкой?У меня есть коды выше, но в настоящее время он читает по пути, как заставить его читать из запроса SELECT?Имеется в виду запрос «SELECT * FROM Table»