hi to all......
here i done the application in MVC3.Functionality of Export to excel is its working Fine . and Its Stores the Data In My Local System .When I Load My project into IIS 7;
The Data is not Storing into Excel ..and also it is not showing any error in another's System
Here i wrote the code after click on button it goes to store in the Excel.
This is my code...
[HttpPost]
public ActionResult Index(FormCollection fc)
{
HttpFileCollectionBase Files = HttpContext.Request.Files;
string fileName = Files[0].FileName;
fileName = @Url.Content(fileName);
string testcaseId = fc["TestCaseID"].ToString();
var result = (from tab1 in db.TestKeywords
join tab2 in db.Keywords_tbl
on tab1.KeywordName equals tab2.KeywordName into newTable
from tab3 in newTable
join tab4 in db.Parameter_tbl
on tab3.KeywordId equals tab4.KeywordId
where tab1.TestCaseId == testcaseId
select new
{
tab1.TestCaseId,
tab1.KeywordName,
tab3.Description,
tab4.ParamName,
tab4.ParamDescription,
tab4.ParamValue
}).ToList();
TextWriter sw = new StreamWriter(fileName);
sw.WriteLine("TestCase ID\tKeyWord Name\tKeyWord Description\tParameter Name\tParameter Description\tParameter Value");
sw.WriteLine(
);
foreach (var item in result)
{
sw.Write(item.TestCaseId + "\t");
sw.Write(item.KeywordName + "\t");
sw.Write(item.Description + "\t");
sw.Write(item.ParamName + "\t");
sw.Write(item.ParamDescription + "\t");
sw.Write(item.ParamValue + "\n");
}
sw.Close();
return View();
}
Please Guide me .
Thanks in Advance
ManoRama
ManoRama