Using the Web.Config to set up my SQL database connection string?

前端 未结 8 1419
一整个雨季
一整个雨季 2020-12-24 13:17

Can anyone help me out please? I\'m confused.

I want to set up my connection string so I can just call it from my Web.Config file.

I need a way to call it f

8条回答
  •  攒了一身酷
    2020-12-24 14:18

    If you are using SQL Express (which you are), then your login credentials are .\SQLEXPRESS

    Here is the connectionString in the web config file which you can add:

    
    
    
    

    Place is just above the system.web tag.

    Then you can call it by:

    connString = ConfigurationManager.ConnectionStrings["nametoCallBy"].ConnectionString;
    

提交回复
热议问题