Last post Jul 04, 2009 08:28 AM by Mikesdotnetting
Jun 25, 2009 12:17 PM|mstrandb|LINK
I'm trying to write some code that will select records from an Access database linked to a SharePoint list. So far, I've gotten this far:
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.IO" %>
Dim AccessConnection as New OledbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & server.mappath("Responsibilities1.accdb") & ";")
sub page_load(sender as object, e as eventargs)
dim sql as string="select * from Responsibilities"
dim objCmd as new oledbCommand(sql, AccessConnection)
dim reader as oledbdatareader
catch ex as exception
As is, I have no problems. As soon as I remove the two commented sections, the browser just hangs. I need to kill the w3wp.exe process on the web server. I kept the select statement simple as a test, so I don't think it is the syntax. I've also tried
intentionally selecting from an invalid table name and I get an error when I do so. So, I know the table exists.
Is there something I'm missing here? Can you not use a datareader with this type of database? I have with the older .mdb types of Access databases.
Jun 25, 2009 04:10 PM|mstrandb|LINK
I should probably point out that the Responsibilities "table" I'm trying to access is actually a sharePoint list. Is it not possible to select records from this list on another page?
Jul 04, 2009 08:28 AM|Mikesdotnetting|LINK
I am not familiar with linking to Sharepoint lists via Access, but have you tried running the SQL inside the Access database?