我想通过仅使用 vb.net 作为编程语言将记录从我的 gridview 导出到 excel。我见过很多使用 C# 的代码,但我不是 C# 从业者,我只使用 vb.net。
这里是 ZedBee 爵士
<body>
<form id="form1" runat="server">
<div id= "bg">
<div id = "scroll">
    <asp:GridView ID="tblreport" runat="server" CellPadding="4" ForeColor="#333333" 
        style="z-index: 1; left: -1px; top: 0px; position: absolute; height: 1px; width: 880px" 
        BorderColor="Black">
        <AlternatingRowStyle BackColor="White" />
        <EditRowStyle BackColor="#7C6F57" />
        <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#E3EAEB" />
        <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F8FAFA" />
        <SortedAscendingHeaderStyle BackColor="#246B61" />
        <SortedDescendingCellStyle BackColor="#D4DFE1" />
        <SortedDescendingHeaderStyle BackColor="#15524A" />
    </asp:GridView>
    </div>
    <asp:Button ID="Button1" runat="server" 
        style="z-index: 1; left: 410px; top: 396px; position: absolute; height: 26px;" 
        Text="Generate" />
    <asp:Button ID="Button2" runat="server" 
        style="z-index: 1; left: 511px; top: 395px; position: absolute; width: 70px" 
        Text="Cancel" />
    <asp:TextBox ID="TextBox1" runat="server" 
        style="z-index: 1; left: 182px; top: 65px; position: absolute"></asp:TextBox>
    <asp:DropDownList ID="dditem" runat="server" 
        DataSourceID="SqlDataSource1" DataTextField="TABLE_NAME" 
        DataValueField="TABLE_NAME" 
        style="z-index: 1; left: 83px; top: 32px; position: absolute">
    </asp:DropDownList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:dbapproveditemConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:dbapproveditemConnectionString.ProviderName %>" 
        SelectCommand="SELECT TABLE_NAME FROM information_schema.COLUMNS WHERE (TABLE_SCHEMA = 'dbitem') AND (ORDINAL_POSITION = 1)">
    </asp:SqlDataSource>
    <asp:Button ID="Button3" runat="server" 
        style="z-index: 1; left: 330px; top: 62px; position: absolute; width: 62px" 
        Text="OK" />
    <asp:DropDownList ID="DropDownList2" runat="server" 
        style="z-index: 1; left: 82px; top: 65px; position: absolute; height: 16px; width: 79px;">
        <asp:ListItem>Status</asp:ListItem>
    </asp:DropDownList>
</div>
</form>