SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    SQL Server Connection String...

    ... I ALWAYS forget this cause we ALWAYS turn our db connections into COM components...

    That said... I need one for this project

    Here's my base Access one:

    DBPath ="C:\datastores\mediacd.mdb"
    Set Con = Server.CreateObject( "ADODB.Connection" )
    Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & DBPath

    I just don't quite remember the SQL Server variation...
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  2. #2
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Never mind, got it

    Set Con = Server.CreateObject( "ADODB.Connection" )
    Con.Open "DRIVER={SQL Server}; Server=Sinai; Database=CRAVE; UID=; PWD="
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2002
    Location
    Birmingham, UK
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sunny :-)

    Just saw this post... you may find this URL handy.

    http://www.able-consulting.com/ADO_Conn.htm

    Although your connection will undoubtedly work, it's adding a (usually) unnecessary layer to the equation, slowing things down somewhat. ODBC was Microsoft's answer to data access for multiple sources. The recommended method now is OLE DB, so take a look at the connection string below, and take a note of the link above (you never know when it may come in handy ;-)

    oConn.Open "Provider=sqloledb;" & _
    "Data Source=myServerName;" & _
    "Initial Catalog=myDatabaseName;" & _
    "User Id=myUsername;" & _
    "Password=myPassword;"

  4. #4
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yeah, connecting directly via the oledb layer would definitely be a good thing

    Thanx mate. Don't worry though, we use COM for all final release stuff (Just have to go make sure we're connecting via oledb on that end as well now ).

    Thanx for the heads up
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •