#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2010
    Posts
    101
    Rep Power
    4

    Connect to sql server 2005 via text file( with .ini extension)


    file settings.ini

    [Connection_String]
    Driver={SQL Server}
    Server=113.160.248.114,1434
    Database=Northwind
    Uid=xyz
    Pwd=123
    Trusted_Connection=yes



    Dim MyConnect As New ADODB.Connection
    Dim MyRecSet As New ADODB.Recordset
    Dim strSQL As String
    Dim COMMFilePath As String
    COMMFilePath = GetINISetting("COMM", "FilePath", Application.Path & " ")
    MyConnect.Open _
    "Driver={SQL Server};" & _
    "Server = Trim(GetINISetting("Connection_String", "Server", Application.Path & " SETTINGS.INI"));" & _
    "Database = Trim(GetINISetting("Connection_String", "Database", Application.Path & " SETTINGS.INI"));" & _
    "Uid = Trim(GetINISetting("Connection_String", "Uid", Application.Path & " SETTINGS.INI"));" & _
    "Pwd = Trim(GetINISetting("Connection_String", "Pwd", Application.Path & " SETTINGS.INI"));" & _
    "Trusted_Connection = Trim(GetINISetting("Connection_String", "Trusted_Connection", Application.Path & " SETTINGS.INI"));"

    My code above fails, do not work or who have read the example text file. Ini shared with me. thanks
  2. #2
  3. No Profile Picture
    Stumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,409
    Rep Power
    4538
    Use your debugger to look at the resulting string in COMMFilePath
    ======
    Doug G
    ======
    It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

IMN logo majestic logo threadwatch logo seochat tools logo