none
SQLConfigDataSource fails with "Operation cancelled by user" RRS feed

  • Question


  • I'm trying to create an ODBC DSN for SQL Native Client and SQLConfigDataSource fails when I pass NULL for the hWnd.  The error code is "The operation was cancelled by user."

    If I pass a valid hWnd, I get the Native Client parameter dialog and I can enter the data and create the DSN.

    I've included my code snippet below.

        args = "DSN=Dsn1" + Chr$(0) + _
                "Description=Test DSN" + Chr$(0) + _
                "Address=dev_xp" + Chr$(0) + _
                "Server=SQLExpress" + Chr$(0) + _
                "Database=Scout3" + Chr$(0) + _
                Chr$(0)
       
          
        rc = SQLConfigDataSource(hwnd, ODBC_ADD_SYS_DSN, "SQL Native Client", args)

    Any ideas?

    Thanks
    Friday, February 8, 2008 9:13 PM