web 2.0

ASP.NET(vb.net) & Connect Excel Using ADO (DRIVER={Microsoft Excel Driver (*.xls)})

ASP.NET(vb.net) & Connect Excel Using ADO (DRIVER={Microsoft Excel Driver (*.xls)}) - This article example scripts you will learn how to Connect Excel Using ADO (DRIVER={Microsoft Excel Driver (*.xls)}) using ASP.NET Scripts.

ShotDev Focus:
- ASP.NET(vb.net) & Connect Excel Using ADO (DRIVER={Microsoft Excel Driver (*.xls)})

Example

AspNetAdoExcelOleDb.aspx

<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.OleDb"%>
<%@ Page Language="VB" %>
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Dim objConn As New OleDbConnection
Dim dtAdapter As OleDbDataAdapter
Dim dt As New DataTable

Dim strConnString As String
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source="&Server.MapPath("MyXls/MyExcelDB.xls")&";Extended Properties=Excel 8.0;"
objConn = New OleDbConnection(strConnString)
objConn.Open()

Dim strSQL As String
strSQL = "SELECT * FROM [Sheet1$]"

dtAdapter = New OleDbDataAdapter(strSQL, objConn)
dtAdapter.Fill(dt)

'*** BindData To GridView ***'
Me.myDataGrid.DataSource = dt
Me.myDataGrid.DataBind()

dtAdapter = Nothing

objConn.Close()
objConn = Nothing

End Sub

</script>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView id="myGridView" runat="server"></asp:GridView>
</form>
</body>
</html>

Screenshot

ASP.NET(vb.net) & Connect Excel Using ADO (DRIVER={Microsoft Excel Driver (*.xls)})

ASP.NET(vb.net) & Connect Excel Using ADO (DRIVER={Microsoft Excel Driver (*.xls)})
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.