locked
Linq and Access DB. RRS feed

  • Question

  • User651828378 posted

    Hi

    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)

    repeater1.aspx.vb

     

    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
            Repeater1.DataBind()
    
        End Sub
    
    End Class

     

    web.config

    <?xml version="1.0"?>

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

    <configuration>

    <connectionStrings>

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

    </connectionStrings>

    <system.web>

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

    </system.web>

    </configuration>

     

     

     

    Saturday, May 21, 2011 5:24 PM

Answers