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
Is redux flux?
What are the various ways to send content from one page to another?
Is asp.net and .net are same or different?
What do you mean by role-based security?
What are the two properties that are common on every validation control?
What is difference Between Authentication and authorization?
What is the use of global.asax file?
List the types of authentication supported by asp.net?
Where is the view state data stored in asp net?
What is variable and constant in .net programming language?
Explain server side state management system.
What are the main differences between asp and asp.net?
What is paging in context of Memory?
Why we use content place holder in asp.net?
What is the web.config file in asp?