问题
I am trying to establish a connection to a database in my C++ code; however, I am unsure how to do so. My database is Azure SQL which uses microsoft sql server as the backend. Could someone provide me a website or code that executes the connection with the server name, database name, username, and pass?
Thank you
回答1:
To find the connection string, first login to Azure portal, then click your database > Show database connection strings, and you'll see the connection strings for ADO.NET, ODBC, PHP, JDBC.
For c++ code sample of connecting to Azure SQL Database, you can refer to this article https://msdn.microsoft.com/en-us/magazine/dn630643.aspx , use the ODBC connection string of your database.
来源:https://stackoverflow.com/questions/35556143/c-connection-to-azure-sql-or-microsoft-sql-server