Method for getting the DataTable when having connection ID and the SQL command I am quite new to C# and to the ASP.NET programming. When maintaining the legacy code, I have found rather terrible implementation of the method that is used on many places to get the DataTable object with the data filled by the SQL command.

Here is my first approach to rewrite it. Does using work with the return as shown below? Should the da and ds be released explicitly somehow? If ds is released, is the returned DataTable reference counted so that it will not be deleted?

public DataTable getdata2(string connection_string_id, string sqlcmd)
{
    string connstring = ConfigurationManager
        .ConnectionStrings[connection_string_id].ConnectionString;

    // Open the connection and return the first table.
    // A single one should be there, only.
    using (SqlConnection con = new SqlConnection(connstring))
    {
        SqlDataAdapter da = new SqlDataAdapter(sqlcmd, con);
        DataSet ds = new DataSet();
        da.Fill(ds);
        Debug.Assert(ds.Tables.Count == 1);
        return ds.Tables[0];
    }
}
Like janos already stated it is ok to return out of an using block.
Naming
Based on the naming guidelines, method names should be named using PascalCase casing. So getData2 should become GetData2 which should be still renamed to a more meaningful name.
Also input parameters should be named using camelCase casing, so connection_string_id should become connectionStringId.
If you are sure, that there will only be 1 table, you can also use the overloaded Fill() method which takes a DataTable as input parameter.
You could also stack the usings, but this is a matter of taste.
using (SqlConnection con = new SqlConnection(connstring))
using (SqlDataAdapter adapter = new SqlDataAdapter(sqlcmd, con))
{
    con.Open();
    DataTable dataTable = new DataTable();
    adapter.Fill(dataTable);
    return dataTable ;
}

In my opinion, your code does a little bit to much.

Retrieving the ConnectionString
Query the database

So let us add a method to retrieve the ConnectionString, which is then passed to the Getdata2() method.
private String GetConnectionString(String connectionStringId)
{
    return ConfigurationManager
        .ConnectionStrings[connectionStringId].ConnectionString;
}  


public DataTable GetData2(String connectionString, String sqlCommand)
{

    using (SqlConnection connection = new SqlConnection(connectionString))
    using (SqlDataAdapter adapter = new SqlDataAdapter(sqlCommand, connection))
    {
        con.Open();
        DataTable dataTable = new DataTable();
        adapter.Fill(dataTable);
        return dataTable ;
    }
}

To answer when to use using: use it if the related object implements the IDisposable interface.