Connecting to an Access mdb web.config

Discussion in 'ASP .Net' started by msch-prv@bluewin.ch, Jul 19, 2006.

  1. Guest

    I have difficulties declaring and using an Access connection string.
    The web.config declaration is:

    <connectionStrings>
    <add name="DbConn"
    connectionString="~/App_Data/CRM2K_be.mdb"
    providerName="System.Data.OleDb"/>
    </connectionStrings>

    In the Page_Load event, I have the following:

    Dim sqlSrc As SqlDataSource
    sqlSrc = New
    SqlDataSource(ConfigurationManager.ConnectionStrings("DbConn").ConnectionString,
    "SELECT CustLName FROM tblCust")
    grd2.DataSource = sqlSrc
    grd2.DataBind()

    When I run the page, an initialization error pops up: 'Format of the
    initialization string does not conform to specification starting at
    index 0'

    What is the proper syntax (ASP.NET 2.0)? Are there some Access sample
    apps to demonstrate these pinciples? Most of the samples rely on SQL
    Express.

    (Side comment: As a newbie, I find ASP.NET 2.0 really tough to get a
    hang on. The MS literature is overwhelming, but not really useful if
    you are learning the basics.)

    TIA, Mark
    , Jul 19, 2006
    #1
    1. Advertising

  2. Guest

    Sorry, I found the answer to my question. By mistake, I used a
    SqlDataSource object instead of AccessDataSource.

    Substituting back makes it work ie:
    sqlSrcAcc = New
    AccessDataSource(ConfigurationManager.ConnectionStrings("DbConn").ConnectionString,
    "SELECT CustLName FROM tblCust")

    Question: Instead of using explicit SQL statements, would it be
    possible to import Access queries into the sqlSrcAcc object?

    TIA, Mark
    , Jul 19, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KQ
    Replies:
    1
    Views:
    438
  2. =?Utf-8?B?UGhpbA==?=

    Faster access to MDB? MS Access MDB and ASP

    =?Utf-8?B?UGhpbA==?=, Jan 26, 2005, in forum: ASP .Net
    Replies:
    8
    Views:
    456
    Kevin Spencer
    Jan 27, 2005
  3. John  Schult

    MDB to MDB Event Notification

    John Schult, May 4, 2005, in forum: Java
    Replies:
    0
    Views:
    460
    John Schult
    May 4, 2005
  4. CSharpner
    Replies:
    0
    Views:
    999
    CSharpner
    Apr 9, 2007
  5. Manish Agarwal
    Replies:
    5
    Views:
    650
    Gregory A. Beamer
    Jul 10, 2009
Loading...

Share This Page