Struggling to change an Access Connection string to MS SQL Server

  • Hi there,

    I have an evaluation application that I am trying to configer to use SQL server instead of the built in Access database.

    I have created and set up all the tables and fields on the SQL server, but cannot get the database functionality to connect and work correctly.

    The string this is used for the Access DB is as follows:

    Function OpenDB

    Dim Conn

    ' Connect the database

    Set Conn = Server.CreateObject("ADODB.Connection")

    Conn.Provider = "Microsoft.Jet.OLEDB.4.0"

    Conn.Open Server.MapPath("dbname.mdb")

    Set OpenDB = Conn

    End Function

    For SQL server, the string is usually very different, like:

    Conn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=username;pwd=password;Initial Catalog=MyDatabse;Data Source=ServerName"

    How and where can I make changes to this string, so that I can get things to work with SQL Server, rather than with Access?

    Many thanks

    Hans

  • This sounds like an application level issue vs. a database issue.;-)

  • The exact string you use depends upon how you connect to the SQL server back end (the Provider) and how the security/authentication is set up on SQL server. Below is a helpful resource on connection strings with examples (it's geared toward SQL Server 2005, but a lot of it applies to later versions) and other information:

    http://www.connectionstrings.com/sql-server-2005

    ____________
    Just my $0.02 from over here in the cheap seats of the peanut gallery - please adjust for inflation and/or your local currency.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply