I am trying to figure out if there is a way where I could view a table from an access 2007 database located on a unc path the sharepoint server has access to and get it to show up in a web part (content editor web part) in SharePoint? Below is what I have tried and not successfull. At first I thought it may have been due to my type connection. Im still not sure if it is. I am trying to create a DSN-Less connection from the SharePoint server web page to the Access database on the network. Am I close, or is this even possible?
The database name is: Testdb.accdb
Contains one table: TestTbl
TestTbl contains two fields/columns: TestField and TestField2
There are 10 rows/records with data in the fields
SharePoint 2007 Enterprise
The database name is: Testdb.accdb
Contains one table: TestTbl
TestTbl contains two fields/columns: TestField and TestField2
There are 10 rows/records with data in the fields
SharePoint 2007 Enterprise
Code:
<%@ Language="Vbscript" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Link Test to Access 2007 DB</title>
</head>
<body>
<%
Dim cnnSimple 'ADO connection
Dim rstSimple 'ADO recordset
Set cnnSimple = New ADODB.Connection
cnnSimple.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="[URL="file://\\svr1\public\ar\ms"]\\svr1\public\ar\ms[/URL] reg\all digl\TestDB.accdb"; Persist Security Info=False;"
set rstSimple = cnnSimple.Execute("SELECT TestField FROM TestTbl")
%>
<P> Connecting to Access with Ole connection </P>
<table border="1">
<%
Do While Not rstSimple.EOF
%>
<tr>
<td><%= rstSimple.Fields(0).Value %></td>
</tr>
<%
rstSimple.MoveNext
Loop
%>
</table>
<%
rstSimple.Close
Set rstSimple = Nothing
cnnSimple.Close
Set cnnSimple = Nothing
%>
</body>
</html>