将Excel中数据导入到Access数据库中的方法

将Excel中数据导入到Access数据库中的方法

Default.aspx

复制代码 代码如下:


<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <style type="text/css">

.style1
        {
            height: 16px;
        }
        .style3
        {
            height: 23px;
        }
    </style>
</head>
<body>
    <form runat="server">

<div>

    </div>
    <table bordercolor="honeydew" cellpadding="0"
        cellspacing="0">
        <tr>
            <td
               >
            </td>
            <td colspan="2"
               >
                将Excel数据写入Access数据库中</td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                <iframe scrolling="yes" src="https://www.jb51.net/学生成绩.xls"
                   ></iframe>
            </td>
            <td>
                <asp:GridView runat="server" CellPadding="4" Font-Size="9pt"
                    ForeColor="#333333" GridLines="None">
                    <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                    <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td
                valign="top">
                <asp:Button runat="server" Font-Size="9pt"
                    Text="Excel数据写入Access数据库中" />
    <asp:Label runat="server" Text="Label" Visible="False"
                   ></asp:Label>
            </td>
            <td>
                <asp:Button runat="server" Font-Size="9pt"
                    Text="数据库中显示Excel数据" />
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
        </tr>
    </table>
    </form>
</body>
</html>

Default.aspx.cs

复制代码 代码如下:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjgpxx.html