G
Guest
I'd like to specify the connection string to the SQL Server so that I can just
refer to it instead of the full connection string.
Here's what I have:
<app.config>
<appSettings>
<add key="SQLDBConn",value="Server=SqlSrvr;Database=DBName;User
ID=uid;Password=pwd;Trusted_Connection=False" />
</appSettings>
Then in my code I replace the connection string with the key "SQLDBConn":
SqlConnection conn = new SqlConnection(SQLDBConn);
But I get an error when I compile that it does not exist in the namespace.
What have I done wrong?
Thanks.
refer to it instead of the full connection string.
Here's what I have:
<app.config>
<appSettings>
<add key="SQLDBConn",value="Server=SqlSrvr;Database=DBName;User
ID=uid;Password=pwd;Trusted_Connection=False" />
</appSettings>
Then in my code I replace the connection string with the key "SQLDBConn":
SqlConnection conn = new SqlConnection(SQLDBConn);
But I get an error when I compile that it does not exist in the namespace.
What have I done wrong?
Thanks.