Linq and Access DB. RRS feed

  • Question

  • User651828378 posted


    Is it possible to use this with a access DB .accdb and what do i then Add in my web.config and what do i edit in this script.
    (this is from a working ex. for SQL DB)



    Imports System
    Imports System.Linq
    Public Class repeater1
        Inherits System.Web.UI.Page
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not IsPostBack Then
                Call linqdb()
            End If
        End Sub
        Public Sub linqdb()
            Dim dc As New TheConnectionStringDataContext()
            Dim q = _
                From a In dc.GetTable(Of TheTable)() _
                Order By a.TestID Descending _
                Select a
            Repeater1.DataSource = q.ToList
        End Sub
    End Class



    <?xml version="1.0"?>

    <!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 -->



    <add name="webtestConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\webtest.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />



    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />






    Saturday, May 21, 2011 5:24 PM