简体   繁体   中英

How to create DSN in Azure environment?

I'm trying to create a DSN on an Azure hosted environment using the following code:

    public static bool AddSystemDsn(string server, string database)
    {
        return SQLConfigDataSource((IntPtr)0,
            4, //4 = ODBC_ADD_SYS_DSN
           "SQL Server\0",
           $"SERVER={server}\0DSN={database}\0DATABASE= 
           {database}\0TRUSTED_CONNECTION=Yes\0ANSINPW=NO");
    }

It's returning False, but I'm not sure why. I wonder if there better code I should be using to make a DSN on an Azure environment?

教程可以帮助您在 sql-server 上使用 ODBC 驱动程序创建系统 DNS。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM