![]() ![]() In this scenerio there is no need to specify user name and password of SQL server. ![]() We will create two types of connection strings:ġ) Connection string using Windows Authentication.Ģ) Connection string using SQL Server Authentication.Ĭonnection string using Windows Authentication: In this article we will use connection string to communicate with MsSql Server database. If we are using MySql server then provider is : “” If we are using MsSql Server then provider is: “” Net connection string are:ġ) “ name”: Name of the connection stirng.Ģ) " Data Source": Name of the Sql Server Instance.ģ) " Initial Catalog": Name of database you want to communicate with.Ĥ) " User ID": User Name you have created to login into SQL Server.ĥ) " Password": Password you have created to login into SQL Server.Ħ) " providerName": This varies based on database we are using.Į.g. The example below, shows how to read connection strings from App. The same ConfigurationManager class can be used to read connection string from App.config file. Some of the main parameters present in Asp. Storing connection strings in App.config is similar to web.config. You can use connection string with any database like MSSQL, MySQL, MS Access etc. DotNetNuke ships with the files for installation on sql server, and by default a connection string of SiteSqlServer is used to determine what connection string to use. Connection string holds information that is required to communicate with the database. The connectionString node in web.config is where asp.net retrieves connection strings from. net tutorial we will learn how to declare connection string in web.config file and how to use connection string in our website pages. ConnectionStrings.ToString() įor both, we need to import nfiguration namespace for reading connection string from web.config file.In this asp. Reading connection string from appSettings, protected void Page_Load( object sender, EventArgs e) For this purpose, you have to touch the web.config file directly or edit the. ![]() We can also get get connection string from the appSettings of web config file in asp.net c#. The SQL Server provider then uses a connection string that accesses the. Reading connection string from ConnectionString, protected void Page_Load( object sender, EventArgs e) We can access the database using the connection string, here we are assigned to a string variable using ConfigurationManager c# class. Write inside the in web config configuration file. ![]() Two ways to write the connection string in web.config file as,ġ. In this article, I will show you how to get string connection from web.config file in asp.net using c#. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |