I have the following code but it seems to not connect, just wondering whether i’m referring to the variable wrong?
sqlConnectionNW.ConnectionString = "Data Source=@server;Initial Catalog=Northwind;Integrated Security=True";
When I change it to:
sqlConnectionNW.ConnectionString = "Data Source=ISSP\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True";
It works fine. It’s just when I change it to the variable ‘server’.
when you write something between “” it’s recognized as a string, to use a variable you have to write it outside of the “”‘s and with a + before it.if some more variable or string is coming behind you must use another + after your variable.