اخواني السلام عليكم ورحمة الله وبركاتة
هذا كود يقراء ملف اكسل لكن الاصدار 97 xls
هل ممكن تعديل حتي يقراء ملفات الاكسل الاصدار 2010 xlsx
اتمنا مساعدتي
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Oledb" %>
<script language="VB" runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Dim objDataSet As New DataSet()
'Change the data source to your excel sheet.
'This is just a demo; I included a spread sheet so
'the demo runs with no change.
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath(".") & "\wk16.xls;" & _
"Extended Properties=""Excel 8.0;"""
Dim objDataAdapter As New OledbDataAdapter("SELECT * FROM [sheet1$]", strConn)
objDataAdapter.Fill(objDataSet)
DataGrid1.DataSource = objDataSet.Tables(0).DefaultView
DataGrid1.DataBind()
End Sub
</script>
<html>
<head></head>
<body>
<p><asp:Label id=Label1 runat="server"><B>The SpreadSheet</B></asp:Label></p>
<asp:DataGrid id=DataGrid1 runat="server"/>
</body>
</html>