ToString() public method

public ToString ( ) : string
return string
Beispiel #1
0
    public void GetConnectionString()
    {
        try
        {
            if (rootWebConfig.ConnectionStrings.ConnectionStrings.Count > 0)
            {
                connString = rootWebConfig.ConnectionStrings.ConnectionStrings["Expenses"];
                if (connection == null)
                {
                    connection = new SqlConnection(connString.ToString());

                    Session["Connection"] = connection;
                    //connection.Open();
                }
            }
        }
        catch (Exception e)
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(),
                                                    "MessageBox", "alert('" + e.Message + "');", true);
        }

        finally
        {
            if (connection != null && connection.State == ConnectionState.Open)
            {
                connection.Close();
            }
        }
    }
Beispiel #2
0
    public db()
    {
        _settings = System.Configuration.ConfigurationManager.ConnectionStrings["Database"];

        try
        {
            _sqlConnection = new System.Data.SqlClient.SqlConnection();
            _sqlConnection.ConnectionString = _settings.ToString();
            _sqlConnection.Open();
        }
        catch (Exception msg)
        {
        }
    }
Beispiel #3
0
    public db()
    {
        _settings = System.Configuration.ConfigurationManager.ConnectionStrings["Database"];

        try
        {
            _sqlConnection = new System.Data.SqlClient.SqlConnection();
            _sqlConnection.ConnectionString = _settings.ToString();
            _sqlConnection.Open();
        }
        catch (Exception msg)
        {
        }
    }
		public void ToStringTest ()
		{
			ConnectionStringSettings s = new ConnectionStringSettings (
				"name", "connectionString", "provider");
			Assert.AreEqual ("connectionString", s.ToString(), "A1");
		}