dsnless connection to sql

Posted on 2005-05-02
Last Modified: 2010-03-19

I have used a solution for an online events calendar written by someone else which uses a an access database with a dsnless connection.  

I have migrated the access database to sql using DTS.  I wondered if someone can point me in the right direction in terms of the syntax i have to use to point to the sql database.  Please see below the original syntax used to point to the access database.

dim dsn
dim Conn
dsn="DBQ=" & Server.Mappath("o12cal.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open dsn

My new sql database is also called o12cal

Thanks in advance

Question by:grantballantyne
    LVL 13

    Accepted Solution

    Conn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=YourDatabase;Data Source=YourServer"

    Author Comment

    Hi thanks for the advise, could you advise of the full syntax, im anabsolute beginner in dsnless connections.


    LVL 13

    Expert Comment

    It has nothing to with DSN, it is OLEDB connection string. Create an empty test.udl file, right click on it, select properties, provider and so on. Then open it in notepad and you have your connection string. I think it is a good point to start on, most syntax differs by provider.
    LVL 23

    Expert Comment

    Set con = Server.CreateObject("Adodb.Connection") "driver={SQL Server};server=Serve_IP;uid=sk;pwd=1111;database=Database_name"

    LVL 11

    Expert Comment

    This will give you more info:
    LVL 13

    Expert Comment

    grantballantyne got what he wanted and forgot on us all ;)

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
    Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now