

…and which are documented in the Sql.Databases() M function here. This tutorial explains all what you have to know to get your code working.It may not be immediately obvious, but you cannot set your own connection string properties when connecting to SQL Server using the built-in SQL Server connector from either Power BI or a modern data source in Azure SSAS/SSAS Tabular 2017:Īll you can do is configure the options that are available in the UI, which in the current version of SSDT looks like this: String sqlQuery = "SELECT, INSERT, UPDATE, DELETE" ĪTTENTION: To use ConfigurationManager class, you have to add new Reference (right click on References in Solution explorer, and Add, go down to select System.Configuraton - and dont forget to add a new nameSpace on the top of the class, where you have the upper code I gave you: Using (SqlCommand cmd = new SqlCommand()) Using (SqlConnection sqlConn = new SqlConnection(sqlConnectionString)) So the code shoudl look like: private static string sqlConnectionString = If you are in C#, you can create an applicaion configuration file (app.Config), which will be having the connection string, with its name: This is an example: connectionString="Data Source=.\SQLEXPRESS AttachDbFilename=C:\MyProject\dbRoomBooking.mdf Integrated Security=True Connect Timeout=30 User Instance=True" Connection string is consisted of more then one parameters. You canot simply set the path to the database, and use it as a connection string. I have gave you all the information required in post above. You can also get list of connection string from ĭo you know what is Connection string to database? Following link contains steps to create connection from Server Explorerĭata Source=myServerAddress Initial Catalog=myDataBase User Id=myUsername Password=myPassword You can create a new connection from Server Explorer and copy connection strings from properties in your project.
