What is the difference between Server.Transfer and
Response.Redirect? Why would you choose one over the other?
Answer Posted / d
using System.Data.OleDb;
string strFilePath = @"D:\Development\Test.xlsx";
try {
string strConnectionString = string.Empty;
//strConnectionString =
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
strFilePath + @";Extended Properties=""Excel
8.0;HDR=YES;IMEX=1""";
strConnectionString =
@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
strFilePath + @";Extended Properties=""Excel 12.0
Xml;HDR=YES;IMEX=1""";
OleDbConnection cnCSV = new OleDbConnection
(strConnectionString);
cnCSV.Open();
OleDbCommand cmdSelect = new OleDbCommand
(@"SELECT * FROM [Sheet1$]", cnCSV);
OleDbDataAdapter daCSV = new OleDbDataAdapter();
daCSV.SelectCommand = cmdSelect;
DataTable dtCSV = new DataTable();
daCSV.Fill(dtCSV);
cnCSV.Close();
daCSV = null;
Response.Write(dtCSV.Rows.Count);
gvTest.DataSource = dtCSV;
gvTest.DataBind();
} catch (Exception ex) {
} finally {
}
<asp:GridView ID="gvTest" runat="server"
AutoGenerateColumns="false">
<Columns>
<asp:BoundField HeaderText="GDCID" DataField="GDCID" />
<asp:BoundField HeaderText="EmpID" DataField="EmpID" />
</Columns>
</asp:GridView>
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is the difference between mechine.config and web.config?
Does google crawl redirects?
What is asp.net mvc5? : Asp.Net MVC
Is viewstate secure?
what is the difference between response.write() and response.output.write()?
What is content place holder?
Explain what the contents of cookie?
What is the default Orientation property in a Menu control?
How to implement globalization and localization in the use interface in .net.
What is Dynamic Web and discuss its usage with the help of real life examples?
Can we set master page as a start page?
What are strong names?
How to reduce the width of textbox in editcommandcolumn of datagrid?
What is asp net objects?
How can we use Web API with ASP.NET Web Form?