How To Build a connection string from component parameters and display It.
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnectionStringBuilder sub = new SqlConnectionStringBuilder();
sub.DataSource =@"\SQLEXPRESS";
sub.InitialCatalog = "newDatabase";
sub.IntegratedSecurity = true;
sub.MinPoolSize = 5;
sub.MinPoolSize = 15;
sub.LoadBalanceTimeout = 600;
sub.ConnectionReset = true;
Response.Write("" + sub.ConnectionString);
}
}
|
Out Put:
No comments:
Post a Comment