1. Use http://dotnetdevelopment.pastebin.com/ to show your code next time. 2. Why do you have the entire block you're showing us wrapped in comment tags? Lose the <%-- --%>
∞ Andy Badera ∞ +1 518-641-1280 ∞ This email is: [ ] bloggable [x] ask first [ ] private ∞ Google me: http://www.google.com/search?q=andrew%20badera On Sun, Sep 20, 2009 at 1:27 PM, thread <[email protected]> wrote: > > hello > i'm trying to build in C#.net an interface that pulling information > from excel file > from some reason the information is not appearing. > this is the code: > <%-- > > <%@ Page Language="C#" %> > <%@ import Namespace="System.Data" %> > <%@ import Namespace="System.Data.OleDb" %> > <script runat="server"> > > void Page_Load(object sender, EventArgs e) > { > MessageBox.Show("Yaniv"); > string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; > Data Source=C:\Yourspreadsheet.xls; Extended Properties=""Excel > 8.0;HDR=Yes"";"; > string CommandText = "select * from [book$]"; > > OleDbConnection myConnection = new OleDbConnection > (ConnectionString); > OleDbCommand myCommand = new OleDbCommand(CommandText, > myConnection); > > myConnection.Open(); > DataGrid1.DataSource = myCommand.ExecuteReader > (CommandBehavior.CloseConnection); > DataGrid1.DataBind(); > myConnection.Close(); > } > > </script> > <html> > <head> > </head> > <body style="FONT-FAMILY: arial"> > <h2>Simple Data Report > </h2> > <hr size="10" /> > <form runat="server"> > <asp:datagrid id="DataGrid1" runat="server" > EnableViewState="False" ForeColor="Black" BackColor="White" > CellPadding="3" GridLines="None" CellSpacing="1"> > <HeaderStyle font-bold="True" forecolor="white" > backcolor="#4A3C8C"></HeaderStyle> > <ItemStyle backcolor="#DEDFDE"></ItemStyle> > </asp:datagrid> > <hr size="10" /> > </form> > </body> > </html> > > > > --%> > what is wrong? >
